Skip to content

Commit

Permalink
Populate (single-line_ list of AssessmentFactors in Assessments
Browse files Browse the repository at this point in the history
  • Loading branch information
SLornieCYC committed Feb 21, 2024
1 parent e02c687 commit cc24a25
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cin_validator/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def run_all(filename: str, ruleset, select, output):

# click.echo(full_issue_df)
# click.echo(validator.multichild_issues)
click.echo(validator.data_files["AssessmentFactorsList"])
click.echo(validator.data_files["Assessments"])


@cli.command(name="test")
Expand Down
4 changes: 3 additions & 1 deletion cin_validator/ingress.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ def create_Assessments(self, cin_detail):
"AssessmentID": self.AssessmentID,
}
assessment_dict = get_values(elements, assessment_dict, assessment)
assessments_list.append(assessment_dict)

# the get_values function will not find AssessmentFactors on that level so we retrieve these separately.
assessment_factors = assessment.find("FactorsIdentifiedAtAssessment")
Expand All @@ -346,6 +345,7 @@ def create_Assessments(self, cin_detail):
assessment_elements = list(
set(assessment_columns).difference(set(self.id_cols))
)

if assessment_factors is not None:
# if statement handles the non-iterable NoneType that .find produces if the element is not present.
for factor in assessment_factors:
Expand All @@ -364,6 +364,8 @@ def create_Assessments(self, cin_detail):
[self.AssessmentFactorsList, assessment_factors_df],
ignore_index=True,
)
assessment_dict["AssessmentFactors"] = assessment_factors_df["AssessmentFactor"].tolist()
assessments_list.append(assessment_dict)

assessments_df = pd.DataFrame(assessments_list)
self.Assessments = pd.concat(
Expand Down

0 comments on commit cc24a25

Please sign in to comment.