Skip to content

Commit

Permalink
Reworked initial restrictions structure
Browse files Browse the repository at this point in the history
  • Loading branch information
wittenator committed Mar 8, 2024
1 parent 062b82b commit ed72d0c
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 90 deletions.
83 changes: 0 additions & 83 deletions app/app/data/initial_data.json

This file was deleted.

127 changes: 127 additions & 0 deletions app/app/data/initial_restrictions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
[
{
"text":"To discriminate or exploit individuals or groups based on legally protected characteristics and/or vulnerabilities.",
"domain":"Discrimination",
"source":"RAIL Initiative"
},
{
"text":"For weaponry or warfare.",
"domain":"Military",
"source":"RAIL Initiative"
},
{
"text":"To engage or enable fully automated decision-making that adversely impacts a natural person\\'s legal rights without expressly and intelligibly disclosing the impact to such natural person and providing an appeal process.",
"domain":"Legal",
"source":"RAIL Initiative"
},
{
"text":"To engage or enable fully automated decision-making that creates, modifies or terminates a binding, enforceable obligation between entities; whether these include natural persons or not.",
"domain":"Legal",
"source":"RAIL Initiative"
},
{
"text":"For purposes of administration of justice, law enforcement, immigration, or asylum processes, such as predicting that a natural person will commit a crime or the likelihood thereof.",
"domain":"Discrimination",
"source":"RAIL Initiative"
},
{
"text":"To create, present or disseminate verifiably false or misleading information for economic gain or to intentionally deceive the public, including creating false impersonations of natural persons.",
"domain":"Disinformation",
"source":"RAIL Initiative"
},
{
"text":"To utilize personal information to infer additional personal information about a natural person, including but not limited to legally protected characteristics, vulnerabilities or categories; unless informed consent from the data subject to collect said inferred personal information for a stated purpose and defined duration is received.",
"domain":"Privacy",
"source":"RAIL Initiative"
},
{
"text":"To provide medical advice or make clinical decisions without necessary (external) accreditation of the system; unless the use is (i) in an internal research context with independent and accountable oversight and/or (ii) with medical professional oversight that is accompanied by any related compulsory certification and/or safety/quality standard for the implementation of the technology.",
"domain":"Health",
"source":"RAIL Initiative"
},
{
"text":"To synthesize or modify a natural person\\'s appearance, voice, or other individual characteristics, unless prior informed consent of said natural person is obtained.",
"domain":"Disinformation",
"source":"RAIL Initiative"
},
{
"text":"To autonomously interact with a natural person, in text or audio format, unless disclosure and consent is given prior to interaction that the system engaging in the interaction is not a natural person.",
"domain":"Disinformation",
"source":"RAIL Initiative"
},
{
"text":"To provide medical advice and medical results interpretation without external, human validation of such advice or interpretation.",
"domain":"Health",
"source":"Stable Diffusion"
},
{
"text":"In connection with any activities that present a risk of death or bodily harm to individuals, including self-harm or harm to others, or in connection with regulated or controlled substances.",
"domain":"Health",
"source":"Llama2"
},
{
"text":"In connection with activities that present a risk of death or bodily harm to individuals, including inciting or promoting violence, abuse, or any infliction of bodily harm to an individual or group of individuals",
"domain":"Health",
"source":"Llama2"
},
{
"text":"To generate or disseminate personal identifiable information that can be used to harm an individual or to invade the personal privacy of an individual.",
"domain":"Privacy",
"source":"AI Pubs"
},
{
"text":"To engage in, promote, incite, or facilitate the harassment, abuse, threatening, or bullying of individuals or groups of individuals.",
"domain":"Privacy",
"source":"LLama2"
},
{
"text":"For purposes of building or optimizing military weapons or in the service of nuclear proliferation or nuclear weapons technology.",
"domain":"Military",
"source":"AI2 Impact"
},
{
"text":"For purposes of military surveillance, including any research or development relating to military surveillance.",
"domain":"Military",
"source":"AI2 Impact"
},
{
"text":"In any way that violates any applicable national, federal, state, local or international law or regulation.",
"domain":"Legal",
"source":"Big Code"
},
{
"text":"To defame, disparage or otherwise harass others.",
"domain":"General",
"source":"AI Pubs"
},
{
"text":"In connection with any academic dishonesty, including submitting any informational content or output of a Model as Your own work in any academic setting.",
"domain":"Research",
"source":"AI2 Impact"
},
{
"text":"To generate and/or disseminate malware (including - but not limited to - ransomware) or any other content to be used for the purpose of Harming electronic systems;",
"domain":"Malware",
"source":"Big Code"
},
{
"text":"To defame or harm a natural person\\'s reputation, such as by generating, creating, promoting, or spreading defamatory content (statements, images, or other content).",
"domain":"Disinformation",
"source":"Llama2"
},
{
"text":"To generate or disseminate information (including - but not limited to - images, code, posts, articles), and place the information in any public context without expressly and intelligibly disclaiming that the information and/or content is machine generated.",
"domain":"Disinformation",
"source":"Big Code"
},
{
"text":"To Intentionally deceive or mislead others, including failing to appropriately disclose to end users any known dangers of your system.",
"domain":"General",
"source":"Llama2"
},
{
"text":"To engage in, promote, incite, or facilitate discrimination or other unlawful or harmful conduct in the provision of employment, employment benefits, credit, housing, or other essential goods and services.",
"domain":"Discrimination",
"source":"Llama2"
}
]
14 changes: 7 additions & 7 deletions app/app/db/init_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ def init_db(db: Session) -> None:
user = crud.user.create(db, obj_in=user_in) # noqa: F841

# read initial data from json file
with open('app/data/initial_data.json') as f:
with open('app/data/initial_restrictions.json') as f:
data = json.load(f)

for source in set(data['Source'].values()):
for source in set([entry["source"] for entry in data]):
crud.license_source.create(db, obj_in=models.LicenseSourceBase(name=source, approved=True))

for domain in set(data['Domain'].values()):
for domain in set([entry["domain"] for entry in data]):
crud.license_domain.create(db, obj_in=models.LicenseDomainBase(name=domain))

# flush so we can oberserve changes in the database
db.flush()

for i, restriction in data['Restriction'].items():
source_id = crud.license_source.get_by_name(db, name=data['Source'][str(i)]).id
domain_id = crud.license_domain.get_by_name(db, name=data['Domain'][str(i)]).id
for entry in data:
source_id = crud.license_source.get_by_name(db, name=entry["source"]).id
domain_id = crud.license_domain.get_by_name(db, name=entry["domain"]).id
crud.license_restriction.create(db, obj_in=models.LicenseRestriction(
text=restriction,
text=entry["text"],
approved=True,
source_id=source_id,
domain_id=domain_id
Expand Down

0 comments on commit ed72d0c

Please sign in to comment.