2,851
edits
No edit summary |
No edit summary |
||
Line 7: | Line 7: | ||
HDL = {name = "High-Density Lipoprotein (HDL)", system = "Endocrine Metabolic System"}, | HDL = {name = "High-Density Lipoprotein (HDL)", system = "Endocrine Metabolic System"}, | ||
LDL = {name = "Low-Density Lipoprotein (LDL)", system = "Endocrine Metabolic System"} | LDL = {name = "Low-Density Lipoprotein (LDL)", system = "Endocrine Metabolic System"} | ||
} | |||
local rows = { | |||
method = "Biological Age Estimation Method", | |||
year = "Year" | |||
} | } | ||
Line 12: | Line 17: | ||
local studies = { | local studies = { | ||
PMID12345 = { | PMID12345 = { | ||
pmid = 12345, | |||
name = "Study1", | name = "Study1", | ||
method = "MLR", | |||
year = "1995", | |||
data = { | data = { | ||
SBP = " | SBP = "x", | ||
DBP = " | DBP = "x", | ||
HDL = " | HDL = "x", | ||
LDL = " | LDL = "x" | ||
} | } | ||
}, | }, | ||
PMID67890 = { | PMID67890 = { | ||
name = " | name = 67890, | ||
method = "MLR", | |||
year = "1995", | |||
data = { | data = { | ||
SBP = " | SBP = "x", | ||
DBP = " | DBP = "x", | ||
HDL = " | HDL = "x", | ||
LDL = " | LDL = "x" | ||
} | } | ||
}, | }, | ||
PMID13579 = { | PMID13579 = { | ||
pmid = 13579, | |||
method = "MLR", | |||
year = "1995", | |||
data = { | data = { | ||
SBP = " | SBP = "x", | ||
DBP = " | DBP = "x", | ||
HDL = " | HDL = "x", | ||
LDL = " | LDL = "x" | ||
} | } | ||
} | } | ||
Line 47: | Line 59: | ||
wikitable = wikitable .. ' System !! Biomarker' | wikitable = wikitable .. ' System !! Biomarker' | ||
for _, study in pairs(studies) do | for _, study in pairs(studies) do | ||
wikitable = wikitable .. ' !! ' .. study.name | wikitable = wikitable .. ' !! ' .. study.pmid | ||
end | |||
wikitable = wikitable .. '\n' | |||
for key, name in pairs(rows) do | |||
wikitable = wikitable .. '|-\n' | |||
wikitable = wikitable .. '| ' .. name .. ' || ' .. '' | |||
for _, study in pairs(studies) do | |||
local cellValue = study[key] or "" | |||
wikitable = wikitable .. ' || ' .. cellValue | |||
end | |||
wikitable = wikitable .. '\n' | |||
end | |||
-- Generate rows for each biomarker | -- Generate rows for each biomarker | ||
for abbr, details in pairs(biomarkers) do | for abbr, details in pairs(biomarkers) do | ||
wikitable = wikitable .. ' | wikitable = wikitable .. '|-\n' | ||
wikitable = wikitable .. details.system .. ' || ' .. details.name | |||
for _, study in pairs(studies) do | for _, study in pairs(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[abbr] or " | local cellValue = study.data[abbr] or "" | ||
wikitable = wikitable .. ' || ' .. cellValue | wikitable = wikitable .. ' || ' .. cellValue | ||
end | end | ||
wikitable = wikitable .. '\n' | |||
end | end | ||