Two reviewers may enter two decisions for the same paper. The export that drives a review flow diagram needs one finalized row per report. Validate that table before counting.
In this example, a protocol includes randomized trials. A retrieved retrospective cohort has an exclusion reason and a page locator. A third report was sought and could not be retrieved, so it goes into its own flow count. Its blank reason and source are deliberate. The rows below are teaching data.
from collections import Counter reports = [ {"id": "R1", "decision": "included", "reason": "", "source": "Methods, p. 3"}, {"id": "R2", "decision": "excluded", "reason": "wrong study design", "source": "Methods, p. 4"}, {"id": "R3", "decision": "not retrieved", "reason": "", "source": ""}, ] counts = Counter() seen = set() for report in reports: report_id = report["id"] decision = report["decision"] if report_id in seen: raise ValueError(f"Duplicate final decision for {report_id}") if decision not in {"included", "excluded", "not retrieved"}: raise ValueError(f"Resolve the status of {report_id} before export") if decision == "excluded" and not (report["reason"] and report["source"]): raise ValueError(f"Add an exclusion reason and source for {report_id}") seen.add(report_id) counts[decision] += 1 print(f"Reports sought: {len(seen)}") print(f"Reports not retrieved: {counts['not retrieved']}") print(f"Reports assessed: {counts['included'] + counts['excluded']}") print(f"Reports excluded: {counts['excluded']}") The script prints the following counts.
Reports sought: 3 Reports not retrieved: 1 Reports assessed: 2 Reports excluded: 1 The two assessed reports are one included report and one excluded report. Resolve any pending decisions before export. Keep reviewer votes in the screening log and connect related reports before counting included studies. Consult the applicable PRISMA 2020 flow diagram for the fields you need to report.
I work on RigorMed, an AI research workspace. Its public evidence-table example shows how to save a source location alongside a finding for human review.
This article and its synthetic example were drafted with AI and checked by running the example.