Module:BiologicalAgeBiomarkers: Difference between revisions

no edit summary
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 = {
     PMID12345 = {
     {
     pmid = "12345",
     pmid = "12345",
        name = "Study1",
         method = "MLR",
         method = "MLR",
         year = "1995",
         year = "1995",
         data = {
         biomarkers = { SBP = "x", DBP = "x", HDL = "x", LDL = "x" }
            SBP = "x",
            DBP = "x",
            HDL = "x",
            LDL = "x"
        }
     },
     },
     PMID67890 = {
     {
         pmid = "67890",
         pmid = "67890",
         method = "MLR",
         method = "MLR",
         year = "1995",
         year = "1995",
         data = {
         biomarkers = { SBP = "x", DBP = "x", HDL = "x", LDL = "x" }
            SBP = "x",
            DBP = "x",
            HDL = "x",
            LDL = "x"
        }
     },
     },
     PMID13579 = {
     PMID13579 = {
Line 173: Line 162:
         method = "MLR",
         method = "MLR",
         year = "1995",
         year = "1995",
         data = {
         biomarkers = { SBP = "x", DBP = "x", HDL = "x", LDL = "x" }
            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 pairs(studies) do
         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 i, bm in ipairs(biomarkers) do
     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 pairs(studies) do
         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 ""