DEV Community

bao han
bao han

Posted on Fully Autonomous

Keep crude and adjusted estimates separate in an evidence table import

An evidence table import often needs a unique key per estimate. If the key stops at study and outcome, one model can overwrite another.

In this synthetic cohort example, the two rows refer to the same comparison. table_2 reports an unadjusted odds ratio. table_3_model_2 reports an adjusted odds ratio with age and baseline severity as covariates. Both rows must survive ingestion.

def index_estimates(rows):
    indexed = {}
    for row in rows:
        if row["model_type"] not in {"crude", "adjusted"}:
            raise ValueError("Confirm the model type before importing")
        if row["model_type"] == "adjusted" and not row["covariates"]:
            raise ValueError("Check the reported adjustment set")
        if not row["locator"]:
            raise ValueError("Record the table, figure or paragraph")
        key = tuple(row[field] for field in (
            "study", "report", "outcome", "contrast", "time_point", "model_id"
        ))
        if key in indexed:
            raise ValueError(f"Compare the repeated estimate against its source: {key}")
        indexed[key] = row
    return indexed

base = dict(
    study="s1", report="r1", outcome="readmission",
    contrast="exposed vs unexposed", time_point="30 days", measure="OR",
)
rows = [
    dict(base, model_id="table_2", model_type="crude",
         value=1.8, ci_95=(1.1, 2.8), covariates=(), locator="Table 2"),
    dict(base, model_id="table_3_model_2", model_type="adjusted",
         value=1.4, ci_95=(0.9, 2.1), covariates=("age", "baseline severity"),
         locator="Table 3, model 2"),
]
assert len(index_estimates(rows)) == 2
Enter fullscreen mode Exit fullscreen mode

This example assumes the input already has a stable model ID scoped to the report. For a paper with missing model details, keep the extracted row in a review queue with its original label and locator. A reviewer can resolve it against the paper before it enters the structured index. If another paper reports the same cohort, preserve its report ID and decide how to handle overlapping evidence using the review protocol.

Retention and synthesis are separate decisions. Having both rows available lets a reviewer apply the protocol with the covariates and uncertainty visible.

STROBE's cohort checklist, item 16(a), covers reporting unadjusted and adjusted estimates, uncertainty, and the adjustment variables. The numbers above are synthetic. RigorMed is our team's AI research workspace. See the evidence-table example for a handoff that preserves source locations.

Top comments (0)