Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
54 changes: 54 additions & 0 deletions .github/scripts/generate_rationales.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env python3
"""
Reads summary_table.md and writes rationales.csv.

The output CSV contains one row per failed test case (Match = ❌) with blank
Fixed and Reason columns, ready to be filled in by reviewer.

Usage:
python generate_rationales.py <summary_table.md> <rationales.csv>
"""

import argparse
import csv
import re
import sys
from pathlib import Path


def generate(summary_path: Path, output_path: Path) -> int:
if not summary_path.exists():
print(f"ERROR: {summary_path} not found", file=sys.stderr)
return 1

failed = []
for line in summary_path.read_text(encoding="utf-8").splitlines():
if not line.startswith("|"):
continue
cols = [c.strip() for c in line.strip("|").split("|")]
if len(cols) < 6:
continue
rule, typ, num, match = cols[0], cols[1], cols[2], cols[5]
if not re.match(r"CORE-\d+", rule):
continue
if "\u274c" in match: # ❌
failed.append((rule, typ, num))

with output_path.open("w", newline="", encoding="utf-8") as f:
writer = csv.writer(f)
writer.writerow(["Rule", "Type", "Number", "Fixed", "Reason"])
for rule, typ, num in failed:
writer.writerow([rule, typ, num, "", ""])

print(f"Wrote {len(failed)} rationales to {output_path}")
return 0


if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Generate a rationales.csv template from summary_table.md."
)
parser.add_argument("summary", type=Path, help="Path to summary_table.md")
parser.add_argument("output", type=Path, help="Path for the output rationales.csv")
args = parser.parse_args()
sys.exit(generate(args.summary, args.output))
4 changes: 2 additions & 2 deletions .github/scripts/run_validation.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# run_validation.sh — iterates all positive/ and negative/ test cases for a rule,
# run_validation.sh — iterates all negative/ and positive/ test cases for a rule,
# runs the CORE engine against each, prints output to results.csv,
# diffs against any expected results.csv, and writes two outputs:
# - $REPO_ROOT/validation_report.md (detailed markdown, legacy/fallback)
Expand Down Expand Up @@ -86,7 +86,7 @@ print(json.dumps({
# ---------------------------------------------------------------------------
# Iterate test types and cases
# ---------------------------------------------------------------------------
for TEST_TYPE in positive negative; do
for TEST_TYPE in negative positive; do
TYPE_DIR="$RULE_DIR/$TEST_TYPE"
[ -d "$TYPE_DIR" ] || continue

Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/update-published-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ jobs:
run: |
[ -f summary_table.md ] && cat summary_table.md >> $GITHUB_STEP_SUMMARY || true

# -----------------------------------------------------------------------
# 6a. Generate rationales.csv template from summary_table.md
# -----------------------------------------------------------------------
- name: Generate rationales CSV
if: always()
run: python .github/scripts/generate_rationales.py summary_table.md rationales.csv

# -----------------------------------------------------------------------
# 7. Upload reports as artifacts (regardless of outcome)
# -----------------------------------------------------------------------
Expand All @@ -134,6 +141,7 @@ jobs:
Published/**/results/results.csv
summary_table.md
detail_report.md
rationales.csv
if-no-files-found: warn

# -----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Published/CORE-000004/negative/01/results/results.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Dataset,Record,Variable,Value
EC,7,ECDOSE,0
EC,7,ECDOSE,0.0
EC,7,ECOCCUR,N
2 changes: 0 additions & 2 deletions Published/CORE-000007/negative/01/results/results.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
Dataset,Record,Variable,Value
DM,3,DTHDTC,2018-06-10
DM,3,DTHFL,
DM,3,USUBJID,015246-099-0000-00002
DM,4,DTHDTC,2018-09-04
DM,4,DTHFL,N
DM,4,USUBJID,015246-099-0000-00003
4 changes: 2 additions & 2 deletions Published/CORE-000007/negative/02/results/results.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Dataset,Record,Variable,Value
DM,4,DTHDTC,2018-12-11
DM,4,DTHFL,
DM,3,DTHDTC,2018-12-11
DM,3,DTHFL,
2 changes: 1 addition & 1 deletion Published/CORE-000009/negative/01/results/results.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Dataset,Record,Variable,Value
SE,5,ELEMENT,Unplanned Drug B
SE,5,ETCD,UNPLAN
SE,5,ELEMENT,Unplanned Drug B
14 changes: 1 addition & 13 deletions Published/CORE-000013/negative/01/results/results.csv
Original file line number Diff line number Diff line change
@@ -1,14 +1,2 @@
Dataset,Record,Variable,Value
AE,1,AESTAT,NOT DONE
AE,2,AESTAT,NOT DONE
AE,3,AESTAT,NOT DONE
AE,4,AESTAT,NOT DONE
AE,5,AESTAT,
AE,6,AESTAT,
AE,7,AESTAT,NOT DONE
AE,8,AESTAT,
AE,9,AESTAT,
AE,10,AESTAT,
AE,11,AESTAT,NOT DONE
AE,12,AESTAT,
AE,13,AESTAT,
AE,,AESTAT,NOT DONE
14 changes: 1 addition & 13 deletions Published/CORE-000013/negative/02/results/results.csv
Original file line number Diff line number Diff line change
@@ -1,14 +1,2 @@
Dataset,Record,Variable,Value
AE,1,AESTAT,
AE,2,AESTAT,
AE,3,AESTAT,
AE,4,AESTAT,
AE,5,AESTAT,
AE,6,AESTAT,
AE,7,AESTAT,NOT DONE
AE,8,AESTAT,
AE,9,AESTAT,
AE,10,AESTAT,
AE,11,AESTAT,
AE,12,AESTAT,
AE,13,AESTAT,
AE,,AESTAT,
72 changes: 37 additions & 35 deletions Published/CORE-000014/negative/01/results/results.csv
Original file line number Diff line number Diff line change
@@ -1,101 +1,103 @@
Dataset,Record,Variable,Value
AG,1,AGOCCUR,Y
AG,1,AGPRESP,
AG,1,AGOCCUR,Y
AG,1,AGSTAT,
AG,2,AGOCCUR,N
AG,2,AGPRESP,
AG,2,AGOCCUR,N
AG,2,AGSTAT,
AG,3,AGOCCUR,Y
AG,3,AGPRESP,
AG,3,AGOCCUR,Y
AG,3,AGSTAT,NOT DONE
BE,1,BEOCCUR,Y
BE,1,BEPRESP,
BE,1,BEOCCUR,Y
BE,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,HOSTAT,
MH,1,MHOCCUR,Y
MH,1,MHPRESP,
MH,1,MHOCCUR,Y
MH,1,MHSTAT,
MH,2,MHOCCUR,N
MH,2,MHPRESP,
MH,2,MHOCCUR,N
MH,2,MHSTAT,NOT DONE
MH,3,MHOCCUR,Y
MH,3,MHPRESP,
MH,3,MHOCCUR,Y
MH,3,MHSTAT,NOT DONE
MH,4,MHOCCUR,N
MH,4,MHPRESP,
MH,4,MHOCCUR,N
MH,4,MHSTAT,
ML,1,MLOCCUR,Y
ML,1,MLPRESP,
ML,1,MLOCCUR,Y
ML,1,MLSTAT,
ML,2,MLOCCUR,N
ML,2,MLPRESP,
ML,2,MLOCCUR,N
ML,2,MLSTAT,
ML,3,MLOCCUR,Y
ML,3,MLPRESP,
ML,3,MLOCCUR,Y
ML,3,MLSTAT,NOT DONE
PR,1,PROCCUR,Y
PR,1,PRPRESP,
PR,1,PROCCUR,Y
PR,1,PRSTAT,
PR,2,PROCCUR,N
PR,2,PRPRESP,
PR,2,PROCCUR,N
PR,2,PRSTAT,NOT DONE
PR,3,PROCCUR,Y
PR,3,PRPRESP,
PR,3,PROCCUR,Y
PR,3,PRSTAT,
SU,1,SUOCCUR,Y
SU,1,SUPRESP,
SU,1,SUOCCUR,Y
SU,1,SUSTAT,
SU,2,SUOCCUR,N
SU,2,SUPRESP,
SU,2,SUOCCUR,N
SU,2,SUSTAT,NOT DONE
SU,3,SUOCCUR,Y
SU,3,SUPRESP,
SU,3,SUOCCUR,Y
SU,3,SUSTAT,
50 changes: 25 additions & 25 deletions Published/CORE-000014/negative/02/results/results.csv
Original file line number Diff line number Diff line change
@@ -1,76 +1,76 @@
Dataset,Record,Variable,Value
AG,1,AGOCCUR,Y
AG,1,AGPRESP,
AG,1,AGOCCUR,Y
AG,1,AGSTAT,
AG,2,AGOCCUR,Y
AG,2,AGPRESP,
AG,2,AGOCCUR,Y
AG,2,AGSTAT,NOT DONE
BE,1,BEOCCUR,Y
BE,1,BEPRESP,
BE,1,BEOCC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
ML,2,MLOCCUR,Y
ML,2,MLPRESP,
ML,2,MLOCCUR,Y
ML,2,MLSTAT,NOT DONE
PR,1,PROCCUR,Y
PR,1,PRPRESP,
PR,1,PROCCUR,Y
PR,1,PRSTAT,
PR,2,PROCCUR,Y
PR,2,PRPRESP,
PR,2,PROCCUR,Y
PR,2,PRSTAT,NOT DONE
SU,1,SUOCCUR,Y
SU,1,SUPRESP,
SU,1,SUOCCUR,Y
SU,1,SUSTAT,
SU,2,SUOCCUR,Y
SU,2,SUPRESP,
SU,2,SUOCCUR,Y
SU,2,SUSTAT,NOT DONE
3 changes: 0 additions & 3 deletions Published/CORE-000014/positive/02/results/results.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
Dataset,Record,Variable,Value
SU,1,SUOCCUR,
SU,1,SUPRESP,N
SU,1,SUSTAT,NOT DONE
Loading
Loading