rosemariafontana commited on
Commit
c242cd3
·
verified ·
1 Parent(s): 4e25f40

Update script_for_automation.py

Browse files
Files changed (1) hide show
  1. script_for_automation.py +14 -4
script_for_automation.py CHANGED
@@ -379,10 +379,20 @@ def generate_markdown_output(df):
379
  for _, row in df.iterrows():
380
  # Assuming 'Differences' is a list of dictionaries with keys and changes
381
  differences = row['Differences']
382
- for diff in differences:
383
- if diff.get("values_changed"):
384
- for change in diff["values_changed"]:
385
- markdown += f"| {change['path']} | {change['old_value']} -> {change['new_value']} |\n"
 
 
 
 
 
 
 
 
 
 
386
 
387
  # Side-by-side YAML comparison for human visual inspection
388
  markdown += "\n### Gold Standard vs Machine Generated YAML\n"
 
379
  for _, row in df.iterrows():
380
  # Assuming 'Differences' is a list of dictionaries with keys and changes
381
  differences = row['Differences']
382
+ if isinstance(differences, list):
383
+ for diff in differences:
384
+ # Ensure that diff has a 'values_changed' key
385
+ if isinstance(diff, dict) and 'values_changed' in diff:
386
+ for path, change in diff['values_changed'].items():
387
+ # Ensure we have both 'old_value' and 'new_value'
388
+ if 'old_value' in change and 'new_value' in change:
389
+ markdown += f"| {path} | {change['old_value']} -> {change['new_value']} |\n"
390
+ else:
391
+ print(f"Skipping change at {path} due to missing old or new value")
392
+ else:
393
+ print(f"Skipping non-dictionary diff or missing 'values_changed' key: {diff}")
394
+ else:
395
+ print(f"Expected a list for differences, but got: {type(differences)}")
396
 
397
  # Side-by-side YAML comparison for human visual inspection
398
  markdown += "\n### Gold Standard vs Machine Generated YAML\n"