qqubb commited on
Commit
5aa6a89
·
1 Parent(s): f4fb0fb

fix code for high_risk_ai_system checks and check_prohibited

Browse files
__pycache__/compliance_analysis.cpython-310.pyc CHANGED
Binary files a/__pycache__/compliance_analysis.cpython-310.pyc and b/__pycache__/compliance_analysis.cpython-310.pyc differ
 
__pycache__/utils.cpython-310.pyc CHANGED
Binary files a/__pycache__/utils.cpython-310.pyc and b/__pycache__/utils.cpython-310.pyc differ
 
compliance_analysis.py CHANGED
@@ -1,5 +1,5 @@
1
  import yaml
2
- from utils import set_operator_role_and_location, set_eu_market_status, check_within_scope_cc, check_within_scope_act
3
 
4
  # Create some variables we will use throughout our analysis
5
 
@@ -14,7 +14,7 @@ def check_overall_compliance(cards):
14
  "ai_project_type": {
15
  "ai_system": False,
16
  "gpai_model": False,
17
- "high_risk_ai_system": False,
18
  "gpai_model_systematic_risk": False
19
  },
20
  "operator_details": {
@@ -37,12 +37,14 @@ def check_overall_compliance(cards):
37
  project_cc = yaml.safe_load(project_filepath.read())
38
 
39
 
40
- # check intended purposes
41
- for card in cards['data_file']:
42
- dispositive_variables = check_intended_purpose(dispositive_variables, project_cc, card)
 
 
43
 
44
- for card in cards['model_file']:
45
- dispositive_variables = check_intended_purpose(dispositive_variables, project_cc, card)
46
 
47
 
48
  # for each model_cc and data_cc - run analysis with ref to project_cc
@@ -65,20 +67,20 @@ def run_compliance_analysis_on_project(dispositive_variables, project_cc_yaml):
65
  dispositive_variables['msg'] = "Your project cannot be both an AI system and a GPAI model. Please revise your Project CC accordingly."
66
  return dispositive_variables
67
 
68
- # TODO - move file_exceptions to separate section in project_cc?
69
- # if dispositive_variables['ai_project_type']['ai_system'] == True:
70
- # for value in project_cc_yaml['high_risk_ai_system']:
71
-
72
- # if value and sum(map(bool, [
73
- # project_cc_yaml['high_risk_ai_system']['filter_exception_rights'],
74
- # project_cc_yaml['high_risk_ai_system']['filter_exception_narrow'],
75
- # project_cc_yaml['high_risk_ai_system']['filter_exception_human'],
76
- # project_cc_yaml['high_risk_ai_system']['filter_exception_deviation'],
77
- # project_cc_yaml['high_risk_ai_system']['filter_exception_prep']])
78
- # ) < 1:
79
 
80
- # dispositive_variables['ai_project_type']["high_risk_ai_system"] = True
81
-
82
  if dispositive_variables['ai_project_type']['gpai_model'] == True:
83
  if project_cc_yaml['gpai_model_systematic_risk']['evaluation'] or project_cc_yaml['gpai_model_systematic_risk']['flops']:
84
  dispositive_variables['ai_project_type']["gpai_model_systematic_risk"] = True
@@ -99,149 +101,127 @@ def run_compliance_analysis_on_project(dispositive_variables, project_cc_yaml):
99
  else:
100
  dispositive_variables['msg'].append("Project is not within the scope of what is regulated by the Act.")
101
 
102
-
103
-
104
- # TODO: reactivate the prohibited practices check below
105
-
106
- # TODO: fix and uncomment
107
- # # Check for prohibited practices. If any exist, the analysis is over.
108
- # if check_prohibited(project_cc_yaml) == True:
109
- # print("Project contains prohibited practices and is therefore non-compliant.")
110
- # msg = ("Project is non-compliant due to a prohibited practice.")
111
- # else:
112
- # print("Project does not contain prohibited practies. Let's continue...")
113
 
114
  # If project is high-risk AI system, check that is has met all the requirements for such systems:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
 
116
- if dispositive_variables['ai_project_type']["high_risk_ai_system"]:
117
-
118
- # Do this by examining the Project CC
119
-
120
- for key, value in project_cc_yaml['risk_management_system']:
121
- if not value:
122
- msg = ("Because of project-level characteristics, this high-risk AI system fails the risk management requirements under Article 9.")
123
- for key, value in project_cc_yaml['technical_documentation']:
124
- if not value:
125
- msg = ("Because of project-level characteristics, this high-risk AI system fails the risk management requirements under Article 11.")
126
- for key, value in project_cc_yaml['record_keeping']:
127
- if not value:
128
- msg = ("Because of project-level characteristics, this high-risk AI system fails the risk management requirements under Article 12.")
129
- for key, value in project_cc_yaml['transparency_and_provision_of_information_to_deployers']:
130
- if not value:
131
- msg = ("Because of project-level characteristics, this high-risk AI system fails the transparency requirements under Article 13.")
132
- for key, value in project_cc_yaml['human_oversight']:
133
- if not value:
134
- msg = ("Because of project-level characteristics, this high-risk AI system fails the human oversight requirements under Article 14.")
135
- for key, value in project_cc_yaml['accuracy_robustness_cybersecurity']:
136
- if not value:
137
- msg = ("Because of project-level characteristics, this high-risk AI system fails the accuracy, robustness, and cybersecurity requirements under Article 15.")
138
- for key, value in project_cc_yaml['quality_management_system']:
139
- if not value:
140
- msg = ("Because of project-level characteristics, this high-risk AI system fails the accuracy, robustness, and cybersecurity requirements under Article 17.")
141
-
142
-
143
- # TODO
144
- # # If the project is a GPAI model, check that is has met all the requirements for such systems:
145
-
146
- if dispositive_variables['ai_project_type']["gpai_model"]:
147
-
148
- # # If the project is a GPAI model with systematic risk, check that is has additionally met all the requirements for such systems:
149
-
150
- # if gpai_model_systematic_risk:
151
-
152
- # # Do this by examining the Project CC
153
-
154
- # for key, value in project_cc_yaml['gpai_obligations_for_systemic_risk_models']:
155
- # if not value:
156
- # msg = ("GPAI model with systematic risk fails the transparency requirements under Article 55.")
157
-
158
- # Do this by examining the Project CC
159
 
160
  for key, value in project_cc_yaml['gpai_model_obligations']:
161
  if not value:
162
- msg = ("GPAI model fails the transparency requirements under Article 53.")
163
-
164
-
165
- # if gpai_model_systematic_risk:
166
- # for key, value in project_cc_yaml['gpai_models_with_systemic_risk_obligations']:
167
 
 
 
168
 
169
- # if ai_system:
170
- # for key, value in project_cc_yaml['']:
171
- # TODO to be included in project_cc
172
-
173
-
174
- # TODO: No matter where we land with an orchestrator function, this function must also check to the value it has set for both
175
- # GPAI models with and without systemic risk and then check to see if the relevant requirement have met if either of these values applies.
176
- # This will look a lot like what is happening above for high-risk AI systems.
177
 
178
  return dispositive_variables
179
 
180
  def run_compliance_analysis_on_data(dispositive_variables, data_cc_yaml):
181
 
182
- # TODO: we probably have to pass ai_project_type and project_intended_purpose into this function
183
-
184
- for key, value in data_cc_yaml['data_and_data_governance']:
185
- if not value:
186
- msg = (f"Because of the dataset represented by , this high-risk AI system fails the data and data governance requirements under Article 10.")
187
- for key, value in data_cc_yaml['technical_documentation']:
188
- if not value:
189
- msg = (f"Because of the dataset represented by , this high-risk AI system fails the technical documentation requirements under Article 11.")
190
- for key, value in data_cc_yaml['transparency_and_provision_of_information_to_deployers']:
191
- if not value:
192
- msg = (f"Because of the dataset represented by , this high-risk AI system fails the transparency requirements under Article 13.")
193
- for key, value in data_cc_yaml['quality_management_system']:
194
- if not value:
195
- msg = (f"Because of the dataset represented by , this high-risk AI system fails the quality management requirements under Article 17.")
196
-
197
- # for key, value in data_cc_yaml['gpai_requirements']['gpai_requirements']:
198
- # if not value:
199
- # msg = (f"Because of the dataset represented by {filename}, this GPAI fails the transparency requirements under Article 53.")
200
-
201
- # TODO: No matter where we land with an orchestrator function, this function must also check to the value that has been set for both
202
- # GPAI models with and without systemic risk and then check to see if the relevant requirements have met if either of these values applies.
203
- # Right now it is only checking high-risk AI system requirements. Another thing that we likely have to add here is the cross-comparison of the
204
- # intended purposes. That might look like this:
205
- # if data_cc_yaml['intended_purpose'] not in intended_purposes:
206
- # return false
 
 
207
 
208
  return dispositive_variables
209
 
210
  def run_compliance_analysis_on_model(dispositive_variables, model_cc_yaml):
211
 
212
  # TODO: we probably have to pass ai_project_type and project_intended_purpose into this function
213
-
214
- for key, value in model_cc_yaml['risk_management_system']:
215
- if not value:
216
- msg = (f"Because of the model represented by , this high-risk AI system fails the risk management requirements under Article 9.")
217
- for key, value in data_cc_yaml['technical_documentation']:
218
- if not value:
219
- msg = (f"Because of the model represented by , this high-risk AI system fails the technical documentation requirements under Article 11.")
220
- for key, value in data_cc_yaml['transparency_and_provision_of_information_to_deployers']:
221
- if not value:
222
- msg = (f"Because of the model represented by , this high-risk AI system fails the transparency requirements under Article 13.")
223
- for key, value in data_cc_yaml['accuracy_robustness_cybersecurity']:
224
- if not value:
225
- msg = (f"Because of the model represented by , this high-risk AI system fails the quality management requirements under Article 15.")
226
- for key, value in data_cc_yaml['quality_management_system']:
227
- if not value:
228
- msg = (f"Because of the model represented by , this high-risk AI system fails the quality management requirements under Article 17.")
229
-
230
-
231
- # for key, value in model_cc_yaml['obligations_for_providers_of_gpai_models']:
232
- # if not value:
233
- # msg = (f"Because of the model represented by {filename}, this GPAI fails the transparency requirements under Article 53.")
234
-
235
- # for key, value in model_cc_yaml['obligations_for_providers_of_gpai_models_with_systemic_risk']:
236
- # if not value:
237
- # msg = (f"Because of the model represented by {filename}, this GPAI model with systematic risk fails the transparency requirements under Article 55.")
238
 
239
- # TODO: No matter where we land with an orchestrator function, this function must also check to the value that has been set for both
240
- # GPAI models with and without systemic risk and then check to see if the relevant requirements have met if either of these values applies.
241
- # Right now it is only checking high-risk AI system requirements. Another thing that we likely have to add here is the cross-comparison of the
242
- # intended purposes. That might look like this:
243
- # if model_cc_yaml['intended_purpose'] not in intended_purposes:
244
- # return false
245
 
246
  return dispositive_variables
247
 
 
1
  import yaml
2
+ from utils import set_operator_role_and_location, set_eu_market_status, check_within_scope_cc, check_within_scope_act, check_prohibited
3
 
4
  # Create some variables we will use throughout our analysis
5
 
 
14
  "ai_project_type": {
15
  "ai_system": False,
16
  "gpai_model": False,
17
+ "high_risk_ai_system": True,
18
  "gpai_model_systematic_risk": False
19
  },
20
  "operator_details": {
 
37
  project_cc = yaml.safe_load(project_filepath.read())
38
 
39
 
40
+ # # check intended purposes
41
+ # for card in cards['data_files']:
42
+ # with open(card, 'r') as data_filepath:
43
+ # data_cc = yaml.safe_load(data_filepath.read())
44
+ # dispositive_variables = check_intended_purpose(dispositive_variables, project_cc, data_cc)
45
 
46
+ # for card in cards['model_files']:
47
+ # dispositive_variables = check_intended_purpose(dispositive_variables, project_cc, card)
48
 
49
 
50
  # for each model_cc and data_cc - run analysis with ref to project_cc
 
67
  dispositive_variables['msg'] = "Your project cannot be both an AI system and a GPAI model. Please revise your Project CC accordingly."
68
  return dispositive_variables
69
 
70
+ # TODO check whether high risk before the below?
71
+
72
+ if dispositive_variables['ai_project_type']['ai_system'] == True:
73
+ for value in project_cc_yaml['high_risk_ai_system']:
74
+ if value and sum(map(bool, [
75
+ project_cc_yaml['high_risk_ai_system_exceptions']['filter_exception_rights']['value'],
76
+ project_cc_yaml['high_risk_ai_system_exceptions']['filter_exception_narrow']['value'],
77
+ project_cc_yaml['high_risk_ai_system_exceptions']['filter_exception_human']['value'],
78
+ project_cc_yaml['high_risk_ai_system_exceptions']['filter_exception_deviation']['value'],
79
+ project_cc_yaml['high_risk_ai_system_exceptions']['filter_exception_prep']['value']])
80
+ ) >= 1:
81
 
82
+ dispositive_variables['ai_project_type']["high_risk_ai_system"] = False
83
+
84
  if dispositive_variables['ai_project_type']['gpai_model'] == True:
85
  if project_cc_yaml['gpai_model_systematic_risk']['evaluation'] or project_cc_yaml['gpai_model_systematic_risk']['flops']:
86
  dispositive_variables['ai_project_type']["gpai_model_systematic_risk"] = True
 
101
  else:
102
  dispositive_variables['msg'].append("Project is not within the scope of what is regulated by the Act.")
103
 
104
+ # Check for prohibited practices. If any exist, the analysis is over.
105
+ if check_prohibited(project_cc_yaml) == True:
106
+ print("Project contains prohibited practices and is therefore non-compliant.")
107
+ dispositive_variables['msg'].append("Project is non-compliant due to a prohibited practice.")
108
+ else:
109
+ print("Project does not contain prohibited practies. Let's continue...")
 
 
 
 
 
110
 
111
  # If project is high-risk AI system, check that is has met all the requirements for such systems:
112
+ if dispositive_variables['ai_project_type']["high_risk_ai_system"] == True:
113
+
114
+ for key in project_cc_yaml['risk_management_system']:
115
+ if project_cc_yaml['risk_management_system'][f'{key}']['value'] == True:
116
+ dispositive_variables['msg'].append("Because of project-level characteristics, this high-risk AI system fails the risk management requirements under Article 9.")
117
+ for key in project_cc_yaml['technical_documentation']:
118
+ if project_cc_yaml['technical_documentation'][f'{key}']['value'] == True:
119
+ dispositive_variables['msg'].append("Because of project-level characteristics, this high-risk AI system fails the risk management requirements under Article 11.")
120
+
121
+ for key in project_cc_yaml['record_keeping']:
122
+ if project_cc_yaml['record_keeping'][f'{key}']['value'] == True:
123
+ dispositive_variables['msg'].append("Because of project-level characteristics, this high-risk AI system fails the risk management requirements under Article 12.")
124
+
125
+ for key in project_cc_yaml['transparency_and_provision_of_information_to_deployers']:
126
+ if project_cc_yaml['transparency_and_provision_of_information_to_deployers'][f'{key}']['value'] == True:
127
+ dispositive_variables['msg'].append("Because of project-level characteristics, this high-risk AI system fails the transparency requirements under Article 13.")
128
+
129
+ for key in project_cc_yaml['human_oversight']:
130
+ if project_cc_yaml['human_oversight'][f'{key}']['value'] == True:
131
+ dispositive_variables['msg'].append("Because of project-level characteristics, this high-risk AI system fails the human oversight requirements under Article 14.")
132
+
133
+ for key in project_cc_yaml['accuracy_robustness_cybersecurity']:
134
+ if project_cc_yaml['accuracy_robustness_cybersecurity'][f'{key}']['value'] == True:
135
+ dispositive_variables['msg'].append("Because of project-level characteristics, this high-risk AI system fails the accuracy, robustness, and cybersecurity requirements under Article 15.")
136
+
137
+ for key in project_cc_yaml['quality_management_system']:
138
+ if project_cc_yaml['quality_management_system'][f'{key}']['value'] == True:
139
+ dispositive_variables['msg'].append("Because of project-level characteristics, this high-risk AI system fails the accuracy, robustness, and cybersecurity requirements under Article 17.")
140
 
141
+ if dispositive_variables['ai_project_type']["gpai_model"] == True:
142
+
143
+ if dispositive_variables['ai_project_type']["gpai_model_systematic_risk"] == True:
144
+ for key in project_cc_yaml['gpai_models_with_systemic_risk_obligations']:
145
+ if project_cc_yaml['gpai_models_with_systemic_risk_obligations'][f'{key}']['value'] == True:
146
+ dispositive_variables['msg'].append("GPAI model with systematic risk fails the transparency requirements under Article 55.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
 
148
  for key, value in project_cc_yaml['gpai_model_obligations']:
149
  if not value:
150
+ dispositive_variables['msg'].append("GPAI model fails the transparency requirements under Article 53.")
 
 
 
 
151
 
152
+ # if dispositive_variables['ai_project_type']['ai_system'] == True:
153
+
154
 
 
 
 
 
 
 
 
 
155
 
156
  return dispositive_variables
157
 
158
  def run_compliance_analysis_on_data(dispositive_variables, data_cc_yaml):
159
 
160
+ # # TODO: we probably have to pass ai_project_type and project_intended_purpose into this function
161
+ # if high risk
162
+ # for key, value in data_cc_yaml['data_and_data_governance']:
163
+ # if not value:
164
+ # msg = (f"Because of the dataset represented by , this high-risk AI system fails the data and data governance requirements under Article 10.")
165
+ # for key, value in data_cc_yaml['technical_documentation']:
166
+ # if not value:
167
+ # msg = (f"Because of the dataset represented by , this high-risk AI system fails the technical documentation requirements under Article 11.")
168
+ # for key, value in data_cc_yaml['transparency_and_provision_of_information_to_deployers']:
169
+ # if not value:
170
+ # msg = (f"Because of the dataset represented by , this high-risk AI system fails the transparency requirements under Article 13.")
171
+ # for key, value in data_cc_yaml['quality_management_system']:
172
+ # if not value:
173
+ # msg = (f"Because of the dataset represented by , this high-risk AI system fails the quality management requirements under Article 17.")
174
+
175
+ # if gpai
176
+ # for key, value in data_cc_yaml['gpai_requirements']['gpai_requirements']:
177
+ # # if not value:
178
+ # # msg = (f"Because of the dataset represented by {filename}, this GPAI fails the transparency requirements under Article 53.")
179
+
180
+
181
+ # # TODO: No matter where we land with an orchestrator function, this function must also check to the value that has been set for both
182
+ # # GPAI models with and without systemic risk and then check to see if the relevant requirements have met if either of these values applies.
183
+ # # Right now it is only checking high-risk AI system requirements. Another thing that we likely have to add here is the cross-comparison of the
184
+ # # intended purposes. That might look like this:
185
+ # # if data_cc_yaml['intended_purpose'] not in intended_purposes:
186
+ # # return false
187
 
188
  return dispositive_variables
189
 
190
  def run_compliance_analysis_on_model(dispositive_variables, model_cc_yaml):
191
 
192
  # TODO: we probably have to pass ai_project_type and project_intended_purpose into this function
193
+ # if high risk
194
+ # for key, value in model_cc_yaml['risk_management_system']:
195
+ # if not value:
196
+ # msg = (f"Because of the model represented by , this high-risk AI system fails the risk management requirements under Article 9.")
197
+ # for key, value in data_cc_yaml['technical_documentation']:
198
+ # if not value:
199
+ # msg = (f"Because of the model represented by , this high-risk AI system fails the technical documentation requirements under Article 11.")
200
+ # for key, value in data_cc_yaml['transparency_and_provision_of_information_to_deployers']:
201
+ # if not value:
202
+ # msg = (f"Because of the model represented by , this high-risk AI system fails the transparency requirements under Article 13.")
203
+ # for key, value in data_cc_yaml['accuracy_robustness_cybersecurity']:
204
+ # if not value:
205
+ # msg = (f"Because of the model represented by , this high-risk AI system fails the quality management requirements under Article 15.")
206
+ # for key, value in data_cc_yaml['quality_management_system']:
207
+ # if not value:
208
+ # msg = (f"Because of the model represented by , this high-risk AI system fails the quality management requirements under Article 17.")
209
+
210
+ # if gpai
211
+ # for key, value in model_cc_yaml['obligations_for_providers_of_gpai_models']:
212
+ # # if not value:
213
+ # # msg = (f"Because of the model represented by {filename}, this GPAI fails the transparency requirements under Article 53.")
214
+
215
+ # # for key, value in model_cc_yaml['obligations_for_providers_of_gpai_models_with_systemic_risk']:
216
+ # # if not value:
217
+ # # msg = (f"Because of the model represented by {filename}, this GPAI model with systematic risk fails the transparency requirements under Article 55.")
218
 
219
+ # # TODO: No matter where we land with an orchestrator function, this function must also check to the value that has been set for both
220
+ # # GPAI models with and without systemic risk and then check to see if the relevant requirements have met if either of these values applies.
221
+ # # Right now it is only checking high-risk AI system requirements. Another thing that we likely have to add here is the cross-comparison of the
222
+ # # intended purposes. That might look like this:
223
+ # # if model_cc_yaml['intended_purpose'] not in intended_purposes:
224
+ # # return false
225
 
226
  return dispositive_variables
227
 
project_cc.yaml CHANGED
@@ -30,7 +30,7 @@ ai_system:
30
  ai_system:
31
  article: 'Art. 3(1)'
32
  verbose: 'AI project is a machine-based system that is designed to operate with varying levels of autonomy and that may exhibit adaptiveness after deployment, and that, for explicit or implicit objectives, infers, from the input it receives, how to generate outputs such as predictions, content, recommendations, or decisions that can influence physical or virtual environments'
33
- value: !!bool false
34
 
35
  gpai_model:
36
  gpai_model:
@@ -93,6 +93,8 @@ high_risk_ai_system:
93
  article: 'Art. 6(2); Annex III(8)(a)'
94
  verbose: 'AI project is intended to be used by a judicial authority or on their behalf to assist a judicial authority in researching and interpreting facts and the law and in applying the law to a concrete set of facts, or to be used in a similar way in alternative dispute resolution'
95
  value: !!bool false
 
 
96
  filter_exception_rights:
97
  article: 'Art. 6(3)'
98
  verbose: 'The AI initiate does not pose a significant risk of harm to the health, safety or fundamental rights of natural persons, including by not materially influencing the outcome of decision making'
 
30
  ai_system:
31
  article: 'Art. 3(1)'
32
  verbose: 'AI project is a machine-based system that is designed to operate with varying levels of autonomy and that may exhibit adaptiveness after deployment, and that, for explicit or implicit objectives, infers, from the input it receives, how to generate outputs such as predictions, content, recommendations, or decisions that can influence physical or virtual environments'
33
+ value: !!bool true
34
 
35
  gpai_model:
36
  gpai_model:
 
93
  article: 'Art. 6(2); Annex III(8)(a)'
94
  verbose: 'AI project is intended to be used by a judicial authority or on their behalf to assist a judicial authority in researching and interpreting facts and the law and in applying the law to a concrete set of facts, or to be used in a similar way in alternative dispute resolution'
95
  value: !!bool false
96
+
97
+ high_risk_ai_system_exceptions:
98
  filter_exception_rights:
99
  article: 'Art. 6(3)'
100
  verbose: 'The AI initiate does not pose a significant risk of harm to the health, safety or fundamental rights of natural persons, including by not materially influencing the outcome of decision making'
utils.py CHANGED
@@ -72,20 +72,22 @@ def check_excepted(project_cc_yaml):
72
  else:
73
  return False
74
 
75
- # TODO update function
76
  def check_prohibited(project_cc_yaml):
77
 
78
- ai_system = project_variables['ai_project_type']['ai_system']
79
 
80
  if ai_system:
81
  for key in project_cc_yaml['prohibited_practice']['ai_system']:
82
- if key[value]:
83
  print("You are engaged in a prohibited practice and thus the project is non-compliant.")
84
  return True
85
- if project_cc_yaml['prohibited_practice']['biometric']['categorization']:
86
  print("You are engaged in a prohibited practice and thus the project is non-compliant.")
87
  return True
88
- if project_cc_yaml['prohibited_practice']['biometric']['real_time'] and sum(map(bool, [project_cc_yaml['prohibited_practice']['biometric']['real_time_exception_victim'],project_cc['prohibited_practice']['biometric']['real_time_exception_threat'], project_cc_yaml['prohibited_practice']['biometric']['real_time_exception_investigation']])) == 0:
 
 
 
89
  print("You are engaged in a prohibited practice and thus the project is non-compliant.")
90
  return True
91
  else:
 
72
  else:
73
  return False
74
 
 
75
  def check_prohibited(project_cc_yaml):
76
 
77
+ ai_system = project_cc_yaml['ai_system']['ai_system']
78
 
79
  if ai_system:
80
  for key in project_cc_yaml['prohibited_practice']['ai_system']:
81
+ if project_cc_yaml['prohibited_practice']['ai_system'][f'{key}']['value'] == True:
82
  print("You are engaged in a prohibited practice and thus the project is non-compliant.")
83
  return True
84
+ if project_cc_yaml['prohibited_practice']['biometric']['categorization'] == True:
85
  print("You are engaged in a prohibited practice and thus the project is non-compliant.")
86
  return True
87
+ if project_cc_yaml['prohibited_practice']['biometric']['real_time'] and \
88
+ sum(map(bool, [project_cc_yaml['prohibited_practice']['biometric']['real_time_exception_victim'],
89
+ project_cc_yaml['prohibited_practice']['biometric']['real_time_exception_threat'],
90
+ project_cc_yaml['prohibited_practice']['biometric']['real_time_exception_investigation']])) == 0:
91
  print("You are engaged in a prohibited practice and thus the project is non-compliant.")
92
  return True
93
  else: