2,851
edits
No edit summary |
No edit summary |
||
Line 146: | Line 146: | ||
-- Incorporate data directly into studies identified by PMID | -- Incorporate data directly into studies identified by PMID | ||
local studies = { | local studies = { | ||
{ | |||
pmid = "12345", | pmid = "12345", | ||
method = "MLR", | method = "MLR", | ||
year = "1995", | year = "1995", | ||
biomarkers = { SBP = "x", DBP = "x", HDL = "x", LDL = "x" } | |||
}, | }, | ||
{ | |||
pmid = "67890", | pmid = "67890", | ||
method = "MLR", | method = "MLR", | ||
year = "1995", | year = "1995", | ||
biomarkers = { SBP = "x", DBP = "x", HDL = "x", LDL = "x" } | |||
}, | }, | ||
PMID13579 = { | PMID13579 = { | ||
Line 173: | Line 162: | ||
method = "MLR", | method = "MLR", | ||
year = "1995", | year = "1995", | ||
biomarkers = { SBP = "x", DBP = "x", HDL = "x", LDL = "x" } | |||
} | } | ||
} | } | ||
Line 196: | Line 180: | ||
wikitable = wikitable .. '|-\n' | wikitable = wikitable .. '|-\n' | ||
wikitable = wikitable .. '| ' .. row.name .. ' || ' .. '' | wikitable = wikitable .. '| ' .. row.name .. ' || ' .. '' | ||
for _, study in | for _, study in ipairs(studies) do | ||
local cellValue = study[row.key] or "" | local cellValue = study[row.key] or "" | ||
wikitable = wikitable .. ' || ' .. cellValue | wikitable = wikitable .. ' || ' .. cellValue | ||
Line 204: | Line 188: | ||
-- Generate rows for each biomarker | -- Generate rows for each biomarker | ||
for | for _, bm in ipairs(biomarkers) do | ||
wikitable = wikitable .. '|-\n' | wikitable = wikitable .. '|-\n' | ||
wikitable = wikitable .. '| ' .. bm.system .. ' || ' .. bm.name | wikitable = wikitable .. '| ' .. bm.system .. ' || ' .. bm.name | ||
for _, study in | for _, study in ipairs(studies) do | ||
-- Retrieve data value for the current cell, using the nested structure | -- Retrieve data value for the current cell, using the nested structure | ||
local cellValue = study.data[bm.key] or "" | local cellValue = study.data[bm.key] or "" |