qqubb commited on
Commit
4a41d27
·
1 Parent(s): ef62188

update run_compliance_analysis_on_data

Browse files
.gitignore CHANGED
@@ -1,5 +1,4 @@
1
- __pycache__
2
  compliancecards.code-workspace
3
  .ipynb_checkpoints
4
  *.ipynb
5
- __pycache__/*
 
1
+ __pycache__/
2
  compliancecards.code-workspace
3
  .ipynb_checkpoints
4
  *.ipynb
 
__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
 
compliance_analysis.py CHANGED
@@ -46,10 +46,10 @@ def check_overall_compliance(cards):
46
  # for each model_cc and data_cc - run analysis with ref to project_cc
47
  dispositive_variables = run_compliance_analysis_on_project(dispositive_variables, project_cc)
48
 
49
- # for card in cards['data_files']:
50
- # with open(card, 'r') as data_filepath:
51
- # data_cc = yaml.safe_load(data_filepath.read())
52
- # dispositive_variables = run_compliance_analysis_on_data(dispositive_variables, data_cc_yaml)
53
 
54
  # for card in cards['model_files']:
55
  # with open(card, 'r') as model_filepath:
@@ -156,20 +156,10 @@ def run_compliance_analysis_on_project(dispositive_variables, project_cc_yaml):
156
 
157
  def run_compliance_analysis_on_data(dispositive_variables, data_cc_yaml):
158
 
159
- # # TODO: we probably have to pass ai_project_type and project_intended_purpose into this function
160
- # if dispositive_variables['ai_project_type']["high_risk_ai_system"] == True:
161
- # for value in data_cc_yaml['high_risk_ai_systems']['data_and_data_governance']:
162
- # if not value:
163
- # dispositive_variables['msg'].append(f"Because of the dataset represented by , this high-risk AI system fails the data and data governance requirements under Article 10.")
164
- # for key, value in data_cc_yaml['technical_documentation']:
165
- # if not value:
166
- # dispositive_variables['msg'].append(f"Because of the dataset represented by , this high-risk AI system fails the technical documentation requirements under Article 11.")
167
- # for key, value in data_cc_yaml['transparency_and_provision_of_information_to_deployers']:
168
- # if not value:
169
- # dispositive_variables['msg'].append(f"Because of the dataset represented by , this high-risk AI system fails the transparency requirements under Article 13.")
170
- # for key, value in data_cc_yaml['quality_management_system']:
171
- # if not value:
172
- # dispositive_variables['msg'].append(f"Because of the dataset represented by , this high-risk AI system fails the quality management requirements under Article 17.")
173
 
174
  if dispositive_variables['ai_project_type']["gpai_model"] == True:
175
  for value in data_cc_yaml['gpai_requirements']:
 
46
  # for each model_cc and data_cc - run analysis with ref to project_cc
47
  dispositive_variables = run_compliance_analysis_on_project(dispositive_variables, project_cc)
48
 
49
+ for card in cards['data_files']:
50
+ with open(card, 'r') as data_filepath:
51
+ data_cc = yaml.safe_load(data_filepath.read())
52
+ dispositive_variables = run_compliance_analysis_on_data(dispositive_variables, data_cc)
53
 
54
  # for card in cards['model_files']:
55
  # with open(card, 'r') as model_filepath:
 
156
 
157
  def run_compliance_analysis_on_data(dispositive_variables, data_cc_yaml):
158
 
159
+ if dispositive_variables['ai_project_type']["high_risk_ai_system"] == True:
160
+ for key in data_cc_yaml['high_risk_ai_systems']:
161
+ if data_cc_yaml['high_risk_ai_systems'][f'{key}']['value'] == True:
162
+ dispositive_variables['msg'].append(f"This high-risk AI system fails the {key} requirements under {data_cc_yaml['high_risk_ai_systems'][f'{key}']['article']}.")
 
 
 
 
 
 
 
 
 
 
163
 
164
  if dispositive_variables['ai_project_type']["gpai_model"] == True:
165
  for value in data_cc_yaml['gpai_requirements']:
data_cc.yaml CHANGED
@@ -83,14 +83,14 @@ high_risk_ai_systems:
83
  article: 'Art. 10(2)(e)'
84
  verbose: 'The dataset has been subject to data governance and management practices that include an assessment of the availability, quantity and suitability of the data sets that are needed'
85
  value: !!bool false
86
- ddata_and_data_governance_ata_bias_examination:
87
  article: 'Art. 10(2)(f)'
88
  verbose: 'The dataset has been subject to data governance and management practices that include an examination of possible biases that are likely to affect the health and safety of persons, have a negative impact on fundamental rights or lead to discrimination prohibited under Union law, especially where data outputs influence inputs for future operations'
89
  value: !!bool false
90
  data_and_data_governance_data_and_data_governance_data_bias_mitigation:
91
  article: 'Art. 10(2)(g)'
92
  verbose: 'The dataset has been subject to data governance and management practices that include appropriate measures to detect, prevent and mitigate possible biases that are likely to affect the health and safety of persons, have a negative impact on fundamental rights or lead to discrimination prohibited under Union law, especially where data outputs influence inputs for future operations'
93
- value: !!bool false
94
  data_and_data_governance_data_compliance:
95
  article: 'Art. 10(2)(h)'
96
  verbose: 'The dataset has been subject to data governance and management practices that include identification of relevant data gaps or shortcomings that prevent compliance with this Regulation, and how those gaps and shortcomings can be addressed'
 
83
  article: 'Art. 10(2)(e)'
84
  verbose: 'The dataset has been subject to data governance and management practices that include an assessment of the availability, quantity and suitability of the data sets that are needed'
85
  value: !!bool false
86
+ data_and_data_governance_ata_bias_examination:
87
  article: 'Art. 10(2)(f)'
88
  verbose: 'The dataset has been subject to data governance and management practices that include an examination of possible biases that are likely to affect the health and safety of persons, have a negative impact on fundamental rights or lead to discrimination prohibited under Union law, especially where data outputs influence inputs for future operations'
89
  value: !!bool false
90
  data_and_data_governance_data_and_data_governance_data_bias_mitigation:
91
  article: 'Art. 10(2)(g)'
92
  verbose: 'The dataset has been subject to data governance and management practices that include appropriate measures to detect, prevent and mitigate possible biases that are likely to affect the health and safety of persons, have a negative impact on fundamental rights or lead to discrimination prohibited under Union law, especially where data outputs influence inputs for future operations'
93
+ value: !!bool true
94
  data_and_data_governance_data_compliance:
95
  article: 'Art. 10(2)(h)'
96
  verbose: 'The dataset has been subject to data governance and management practices that include identification of relevant data gaps or shortcomings that prevent compliance with this Regulation, and how those gaps and shortcomings can be addressed'