Clinical research documentation infrastructure

Clinical
Reports

Verified facts → structured drafts → deterministic checks → qualified review

Clinical Reports organizes verified, authorized synthetic, de-identified, or aggregate facts while keeping missing data, conflicts, and pending review visible. It is not an AI doctor and does not make professional decisions.

SAFETY-BOUNDEDFAIL-CLOSEDLOCALPROVENANCE-AWAREDETERMINISTIC
Real Case 02 signal chainLOCAL RUN
SOURCE FACTSfact-case02-12
verified / aggregate
→
PROVENANCETRACEABILITY_COMPLETE_
REVIEW_REQUIRED
REPORT STRUCTUREICH E3 coverage
DRAFT / non-submission
→
VALIDATIONBLOCKED → STRUCTURE_COMPLETE_
REVIEW_REQUIRED
REVIEW REQUIRED · medical · statistical · safety · privacy/legal · quality · regulatory
BEFORE

Traditional preparation

  • facts scattered across sources
  • unsupported claims can slip in
  • structure varies by report type
  • provenance is difficult to trace
  • missing fields are easy to overlook
  • review handoff can be ambiguous
AFTER · REAL CASE 02

With Clinical Reports

PROMPT
VERIFIED FACTS
PROVENANCE IDs
ICH E3 SCAFFOLD
REVIEW REQUIRED
Before: BLOCKED+ fact-case02-12After: STRUCTURE_COMPLETE_REVIEW_REQUIRED

Missing input stays missing/BLOCKED. The structural state changes only after an already verified fact is explicitly linked. A successful result still does not authorize clinical use, signature, filing, or submission.

Current capabilities

These capabilities come only from the current repository SKILL.md, scripts, assets, and references, with a strict separation between structural support, deterministic checks, and decisions reserved for qualified professionals.

01

Report-type routing

Keeps CARE 2013, CONSORT 2025, SPIRIT 2025, ICH E3/E3 Q&A, and aggregate-safety routes distinct.

02

15 fail-closed templates

The generator copies fixed JSON/CSV assets only—no interpolation, clinical completion, or default overwrite.

03

Deterministic structure checks

Checks keys, statuses, and source-fact references for CARE, ICH E3, CONSORT 2025, and SPIRIT 2025.

04

Provenance & consistency

Checks local locators, SHA-256 metadata, claim links, dates, units, n/N percentages, and totals without choosing an authoritative source.

05

Aggregate AE formatting

Accepts aggregate rows plus sidecar metadata; rejects patient/subject/case identifiers, narratives, and onset dates.

06

Bounded auxiliary checks

Terminology checks schema/syntax or exact local-dictionary matches; de-identification checks process documentation. Radiology, pathology, and lab assets are field-map scaffolds.

Safe workflow

Unsupported content remains missing. The scripts do not open patient narratives, call external models, or make clinical or regulatory decisions.

01 · ALLOWED DATA

Synthetic, de-identified, or aggregate facts with explicit purpose, authority, and minimum necessary scope.

02 · INPUT GATE

Stop when boundaries are unmet; real PHI never enters examples, logs, or external services.

03 · PROVENANCE

Local locator, field path, value hash, and verifier role/date.

04 · ROUTING

Choose CARE, CONSORT, SPIRIT, ICH E3, or aggregate route by artifact.

05 · FAIL-CLOSED

Templates begin BLOCKED with missing/null fields; no automatic completion.

06 · VALIDATION

Structure, references, schema, arithmetic, and process documentation.

07 · HUMAN REVIEW

Qualified clinical, statistical, safety, privacy/legal, QA, regulatory, or author review.

A successful validation result does NOT replace qualified review.

Six runs. Three workflows.

Three Chinese runs and three English runs were executed and retained separately. Deterministic tools can return matching states for matching schemas; each language has its own prompt, input, commands, artifacts, and logs.

01

CARE Case Report Structure

Cover the CARE structure only with verified synthetic source-fact IDs; unsupported items remain missing.

synthetic
Prompt | actual run
Using the following fully synthetic source-fact manifest containing no real patient information, generate a CARE case-report draft structure and run the local deterministic validators. Populate only items supported by verified source-fact IDs; keep everything else missing/null. Do not infer diagnosis, treatment, dosage, seriousness, causality, consent, or any unsupported clinical fact. Preserve the DRAFT and qualified-review-required boundaries.
Input | actual
{
  "allowed_data_class": "synthetic",
  "verified_items": [
    "care_items.title",
    "care_items.key_words",
    "care_items.abstract",
    "care_items.introduction",
    "care_items.clinical_findings",
    "care_items.timeline",
    "care_items.discussion"
  ],
  "unsupported_items_remain_missing": [
    "patient_information",
    "diagnostic_assessment",
    "therapeutic_intervention",
    "follow_up_and_outcomes",
    "patient_perspective",
    "informed_consent"
  ],
  "contains_phi": false,
  "draft_warning": "DRAFT — NOT FOR CLINICAL USE, SIGNATURE, FILING, OR SUBMISSION. Populate only from verified authorized source records. Qualified review and sign-off are required."
}
Running process | actual commands
python3 /workspace/scratch/5f7e5f75d1ec/clinical-reports/scripts/generate_report_template.py --type case-report --output generated-template.json
python3 /workspace/scratch/5f7e5f75d1ec/clinical-reports/scripts/provenance_validator.py provenance-manifest.json -o provenance-validation.json
python3 /workspace/scratch/5f7e5f75d1ec/clinical-reports/scripts/check_deidentification.py deidentification-process.json -o deidentification-validation.json
python3 /workspace/scratch/5f7e5f75d1ec/clinical-reports/scripts/validate_case_report.py populated-case-report.json -o care-validation.json
Output / Result | actual artifact
{
  "draft_status": "BLOCKED_INCOMPLETE_DRAFT_NOT_FOR_CLINICAL_USE_OR_SUBMISSION",
  "verified_present": [
    "abstract",
    "clinical_findings",
    "discussion",
    "introduction",
    "key_words",
    "timeline",
    "title"
  ],
  "unsupported_or_blocking": [
    "care_items.patient_information is missing",
    "care_items.diagnostic_assessment is missing",
    "care_items.therapeutic_intervention is missing",
    "care_items.follow_up_and_outcomes is missing",
    "care_items.patient_perspective is missing",
    "care_items.informed_consent is missing",
    "privacy.deidentification_process_record must be a string",
    "privacy.publication_consent_record must be a string",
    "privacy.reidentification_risk_reviewed must be true"
  ]
}
Actual validation result
{
  "care": "BLOCKED",
  "provenance": "TRACEABILITY_COMPLETE_REVIEW_REQUIRED",
  "deidentification_process": "PROCESS_DOCUMENTED_REVIEW_REQUIRED",
  "review_required": true,
  "authorizes_clinical_use_or_submission": false
}
Review status

CARE remains BLOCKED: six CARE items are missing and privacy/publication gates remain incomplete—the intended fail-closed behavior.

REVIEW_REQUIRED = trueSUBMISSION = false
Run evidence summary
CARE remains BLOCKED: six CARE items are missing and privacy/publication gates remain incomplete—the intended fail-closed behavior.
02

ICH E3 CSR Structure

Structural coverage for aggregate trial metadata: missing → link an existing verified fact → validation state changes.

aggregate
Prompt | actual run
Using the following fully synthetic manifest containing only aggregate trial metadata and verified structural facts, create an ICH E3 + E3 Q&A CSR coverage draft and run deterministic validation. First keep safety_evaluation missing and record the failure; then add only the already supplied and verified fact-case02-12 reference and re-run validation. Do not generate efficacy or safety conclusions, participant-level data, or submission decisions.
Input | actual
{
  "allowed_data_class": "aggregate",
  "route": "ICH E3 Step 4 1995-11-30 with Q&A R1 2012-07-06",
  "before": "safety_evaluation remains missing",
  "after": "only pre-existing verified fact-case02-12 is linked",
  "contains_participant_level_data": false,
  "draft_warning": "DRAFT — NOT FOR CLINICAL USE, SIGNATURE, FILING, OR SUBMISSION. Populate only from verified authorized source records. Qualified review and sign-off are required."
}
Running process | actual commands
python3 /workspace/scratch/5f7e5f75d1ec/clinical-reports/scripts/generate_report_template.py --type csr --output generated-template.json
python3 /workspace/scratch/5f7e5f75d1ec/clinical-reports/scripts/provenance_validator.py provenance-manifest.json -o provenance-validation.json
python3 /workspace/scratch/5f7e5f75d1ec/clinical-reports/scripts/validate_trial_report.py csr-before.json -o validation-before.json
python3 /workspace/scratch/5f7e5f75d1ec/clinical-reports/scripts/validate_trial_report.py csr-after.json -o validation-after.json
Output / Result | actual artifact
{
  "before": {
    "safety_evaluation": "missing"
  },
  "verified_change": "fact-case02-12 -> sections.safety_evaluation",
  "after": {
    "safety_evaluation": "verified_present"
  },
  "draft_status": "BLOCKED_INCOMPLETE_DRAFT_NOT_FOR_FILING_OR_SUBMISSION"
}
Actual validation result
{
  "before": {
    "status": "BLOCKED",
    "errors": [
      "sections.safety_evaluation is missing"
    ]
  },
  "after": {
    "status": "STRUCTURE_COMPLETE_REVIEW_REQUIRED",
    "errors": [],
    "warnings": [
      "review.medical_review remains required",
      "review.statistical_review remains required",
      "review.safety_review remains required",
      "review.privacy_legal_review remains required",
      "review.quality_review remains required",
      "review.regulatory_review remains required"
    ]
  },
  "review_required": true,
  "authorizes_clinical_use_or_submission": false
}
Review status

Only the pre-defined verified fact-case02-12 was added—nothing inferred. The result is STRUCTURE_COMPLETE_REVIEW_REQUIRED, not submission readiness.

REVIEW_REQUIRED = trueSUBMISSION = false
Run evidence summary
Only the pre-defined verified fact-case02-12 was added—nothing inferred. The result is STRUCTURE_COMPLETE_REVIEW_REQUIRED, not submission readiness.
03

Aggregate Adverse Event Table

Format synthetic aggregate counts as review-only Markdown and check arithmetic, provenance, terminology syntax, and data-handling process.

aggregate
Prompt | actual run
Using the following fully synthetic aggregate CSV and sidecar metadata, run the local adverse-event formatter plus provenance, terminology-syntax, de-identification-process, and consistency checks. Display only aggregate subjects/events/denominators; do not make individual-case reportability, seriousness, causality, expectedness, treatment, or between-group inferences.
Input | actual
analysis_set,treatment_group,meddra_version,system_organ_class,preferred_term,subjects_affected,event_count,denominator
Synthetic Safety Set,Control,29.0,Synthetic SOC A,Synthetic event alpha,4,5,40
Synthetic Safety Set,Intervention,29.0,Synthetic SOC A,Synthetic event alpha,5,7,42
Synthetic Safety Set,Control,29.0,Synthetic SOC A,Synthetic event beta,2,2,40
Synthetic Safety Set,Intervention,29.0,Synthetic SOC A,Synthetic event beta,3,3,42
Synthetic Safety Set,Control,29.0,Synthetic SOC B,Synthetic event gamma,1,1,40

{
  "allowed_data_class": "aggregate",
  "row_count": 5,
  "contains_identifiers": false,
  "contains_narratives": false,
  "individual_case_decision": "prohibited",
  "draft_warning": "DRAFT — NOT FOR CLINICAL USE, SIGNATURE, FILING, OR SUBMISSION. Populate only from verified authorized source records. Qualified review and sign-off are required."
}
Running process | actual commands
python3 /workspace/scratch/5f7e5f75d1ec/clinical-reports/scripts/generate_report_template.py --type safety-aggregate --output generated-template.json
python3 /workspace/scratch/5f7e5f75d1ec/clinical-reports/scripts/provenance_validator.py provenance-manifest.json -o provenance-validation.json
python3 /workspace/scratch/5f7e5f75d1ec/clinical-reports/scripts/format_adverse_events.py aggregate-ae.csv --metadata aggregate-metadata.json --expected-meddra-version 29.0 --output aggregate-ae-table.md
python3 /workspace/scratch/5f7e5f75d1ec/clinical-reports/scripts/terminology_validator.py terminology-manifest.json -o terminology-validation.json
python3 /workspace/scratch/5f7e5f75d1ec/clinical-reports/scripts/check_deidentification.py deidentification-process.json -o deidentification-validation.json
python3 /workspace/scratch/5f7e5f75d1ec/clinical-reports/scripts/consistency_checker.py consistency-manifest.json -o consistency-validation.json
Output / Result | actual artifact
# Draft aggregate adverse-event table

> DRAFT — aggregate display only. Not an ICSR, reportability decision, clinical interpretation, filing, or submission. Qualified safety and statistical review is required.

- Analysis set: Synthetic Safety Set
- MedDRA version(s), as supplied and not terminology-validated: 29.0
- MedDRA language, as supplied: English
- Counting rule, as supplied: Subjects counted once per supplied preferred term; events shown separately
- Threshold rule, as supplied: All supplied aggregate rows displayed; missing cells remain em dash
- Missing group/term cells are shown as an em dash and are not assumed to be zero.
- Subjects and events are distinct; event counts may exceed subject counts.

| System organ class | Preferred term | Control: subjects n/N (%) | Control: events | Intervention: subjects n/N (%) | Intervention: events |
| --- | --- | --- | --- | --- | --- |
| Synthetic SOC A | Synthetic event alpha | 4/40 (10.0%) | 5 | 5/42 (11.9%) | 7 |
| Synthetic SOC A | Synthetic event beta | 2/40 (5.0%) | 2 | 3/42 (7.1%) | 3 |
| Synthetic SOC B | Synthetic event gamma | 1/40 (2.5%) | 1 | — | — |

Denominators by treatment group: Control N=40; Intervention N=42.

No MedDRA semantic validation, deduplication, inference, causal assessment, or between-group testing was performed.
Actual validation result
{
  "formatter_exit_code": 0,
  "provenance": "TRACEABILITY_COMPLETE_REVIEW_REQUIRED",
  "consistency": "CONSISTENT_WITHIN_DECLARED_TOLERANCES_REVIEW_REQUIRED",
  "terminology": "SCHEMA_VALID_SYNTAX_ONLY_REVIEW_REQUIRED",
  "deidentification_process": "PROCESS_DOCUMENTED_REVIEW_REQUIRED",
  "review_required": true
}
Review status

The table shows subjects, events, and denominators only; missing combinations use an em dash. No MedDRA semantic validation, case assessment, causality, or between-group inference was performed.

REVIEW_REQUIRED = trueSUBMISSION = false
Run evidence summary
The table shows subjects, events, and denominators only; missing combinations use an em dash. No MedDRA semantic validation, case assessment, causality, or between-group inference was performed.

Safety, privacy & reliability

These are operational boundaries proven by the current repository—not claims of compliance or clinical validity.

Runtime facts

Python
3.11+; tested here with 3.12.14
Dependencies
Python standard library only; no requirements.txt in the repository
Network
no network access by bundled tools
Credentials
none required
External models
prohibited
Processing
bounded local files with size, depth, and row limits

Review & limitation facts

PHI
real PHI is prohibited in examples, tests, prompts, logs, or external services
Provenance
every populated field/claim must map to verified source-fact IDs
Validation
structure, references, schema, and internal consistency only
Review owner
qualified human owners by artifact/domain
Regulatory
does not establish legal, regulatory, ethical, journal, or institutional compliance
Release
cannot authorize signature, clinical use, filing, or submission
NO DIAGNOSIS
NO TREATMENT / DOSE
NO TRIAGE
NO IMAGE / RAW LAB INTERPRETATION
NO SERIOUSNESS / CAUSALITY / EXPECTEDNESS INFERENCE
NO ICSR REPORTABILITY DECISION
CLINICAL RESEARCH · MEDICAL WRITING · TRIAL REPORTING · SAFETY · QA

Structure it. Check it. Review it.

For clinical researchers, medical writers, trial reporting teams, aggregate safety reporting teams, regulatory documentation, and QA/review workflows. Organize verified facts into reviewable structures—without generating new medical conclusions.