Jump to content

Module:BiologicalAgeBiomarkers: Difference between revisions

no edit summary
(Created page with "local p = {} p.createTable = function(frame) local numRows = 10 local numCols = 10 local wikitable = '{| class="wikitable"\n' -- Kopfzeile wikitable = wikitable .. '! ' for col = 1, numCols do wikitable = wikitable .. ' !! ' .. col end wikitable = wikitable .. '\n' -- Zeilen und Spalten for row = 1, numRows do wikitable = wikitable .. '|-\n' wikitable = wikitable .. '| ' .. row for col = 1, numCol...")
 
No edit summary
Line 1: Line 1:
local p = {}
local p = {}


p.createTable = function(frame)
-- Define biomarkers with their long form and system
     local numRows = 10
local biomarkers = {
     local numCols = 10
     SBP = {longForm = "Systolic Blood Pressure", system = "Cardiovascular System"},
     local wikitable = '{| class="wikitable"\n'
    DBP = {longForm = "Diastolic Blood Pressure", system = "Cardiovascular System"},
     HDL = {longForm = "High-Density Lipoprotein", system = "Endocrine Metabolic System"},
     LDL = {longForm = "Low-Density Lipoprotein", system = "Endocrine Metabolic System"}
}


     -- Kopfzeile
-- Incorporate data directly into studies identified by PMID
     wikitable = wikitable .. '! '
local studies = {
     for col = 1, numCols do
    PMID12345 = {
         wikitable = wikitable .. ' !! ' .. col
        name = "Study1",
        data = {
            SBP = "120 mmHg",
            DBP = "80 mmHg",
            HDL = "55 mg/dL",
            LDL = "100 mg/dL"
        }
    },
    PMID67890 = {
        name = "Study2",
        data = {
            SBP = "130 mmHg",
            DBP = "85 mmHg",
            HDL = "60 mg/dL",
            LDL = "105 mg/dL"
        }
    },
    PMID13579 = {
        name = "Study3",
        data = {
            SBP = "125 mmHg",
            DBP = "82 mmHg",
            HDL = "57 mg/dL",
            LDL = "102 mg/dL"
        }
    }
}
 
function p.createCrossTable()
    -- Start of the wiki table
    local wikitable = '{| class="wikitable"\n!'
 
     -- Column headers: Biomarker and System
     wikitable = wikitable .. ' !! Biomarker !! System'
     for _, study in pairs(studies) do
         wikitable = wikitable .. ' !! ' .. study.name
     end
     end
    wikitable = wikitable .. '\n'


     -- Zeilen und Spalten
     -- Generate rows for each biomarker
     for row = 1, numRows do
     for abbr, details in pairs(biomarkers) do
         wikitable = wikitable .. '|-\n'
         wikitable = wikitable .. '\n|-\n| ' .. details.longForm .. ' || ' .. details.system
        wikitable = wikitable .. '| ' .. row
         for _, study in pairs(studies) do
         for col = 1, numCols do
            -- Retrieve data value for the current cell, using the nested structure
             wikitable = wikitable .. ' || ' .. row * col
            local cellValue = study.data[abbr] or "-"
             wikitable = wikitable .. ' || ' .. cellValue
         end
         end
        wikitable = wikitable .. '\n'
     end
     end


     -- Tabelle schließen
     -- End of the table
     wikitable = wikitable .. '|}'
     wikitable = wikitable .. '\n|}'
 
     return wikitable
     return wikitable
end
end


return p
return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.