A worksheet can contain a risk ratio of 0.80 alongside interval limits copied from a log-risk-ratio model. The values can look plausible in separate columns. Record the reported scale with each value so a spreadsheet or plotting script can flag the mix-up.
This Python example uses four teaching rows. The source locator is the place to verify the original model output and table heading before changing anything.
from math import isfinite
rows = [
("R1", "ratio", "ratio", 0.80, 0.60, 1.07, "Table 2, row 1"),
("R2", "ratio", "log_ratio", 0.80, -0.51, 0.07, "Table 2, row 2"),
("R3", "log_ratio", "log_ratio", -0.22, -0.51, 0.07, "Table 2, row 3"),
("R4", "ratio", "ratio", 0.80, 1.07, 0.60, "Table 2, row 4"),
]
for row_id, effect_scale, interval_scale, estimate, lo, hi, source in rows:
values = (estimate, lo, hi)
flags = []
if effect_scale != interval_scale:
flags.append("mixed scales")
elif not all(isfinite(value) for value in values):
flags.append("non-finite values")
elif effect_scale == "ratio" and min(values) <= 0:
flags.append("nonpositive ratio")
if lo > hi:
flags.append("reversed bounds")
print(f"{row_id} | {', '.join(flags) or 'no flag'} | {source}")
R1 | no flag | Table 2, row 1
R2 | mixed scales | Table 2, row 2
R3 | no flag | Table 2, row 3
R4 | reversed bounds | Table 2, row 4
For R2, return to the original table and check which numbers are on the natural log scale before converting. For R4, confirm the reported bounds and their order. A row with no flag still needs a source check. The script checks scale labels and numeric form only. It cannot tell whether a column was mislabeled or whether the result matches the protocol.
I work on RigorMed, an AI research workspace. The evidence-table example shows how to retain table and page locators with the values you extract.
AI assisted with the draft. I ran the teaching script and checked its printed output against the article.
See Cochrane Handbook, Chapter 6 for effect measures and log-scale analysis.
Top comments (0)