diff --git a/BaseStudy/build.gradle b/BaseStudy/build.gradle new file mode 100644 index 000000000..1217b2f38 --- /dev/null +++ b/BaseStudy/build.gradle @@ -0,0 +1,18 @@ +import org.labkey.gradle.util.BuildUtils + +plugins { + id 'org.labkey.build.module' +} + +dependencies { + BuildUtils.addLabKeyDependency(project: project, config: "modules", depProjectPath: ":server:modules:DiscvrLabKeyModules:Studies", depProjectConfig: "published", depExtension: "module") + BuildUtils.addLabKeyDependency(project: project, config: "modules", depProjectPath: ":server:modules:DiscvrLabKeyModules:discvrcore", depProjectConfig: "published", depExtension: "module") + + BuildUtils.addLabKeyDependency(project: project, config: "implementation", depProjectPath: ":server:modules:DiscvrLabKeyModules:Studies", depProjectConfig: "apiJarFile") + + BuildUtils.addLabKeyDependency(project: project, config: "implementation", depProjectPath: ":server:modules:LabDevKitModules:laboratory", depProjectConfig: "apiJarFile") + BuildUtils.addLabKeyDependency(project: project, config: "implementation", depProjectPath: ":server:modules:LabDevKitModules:LDK", depProjectConfig: "apiJarFile") + + BuildUtils.addLabKeyDependency(project: project, config: "modules", depProjectPath: ":server:modules:LabDevKitModules:laboratory", depProjectConfig: "published", depExtension: "module") + BuildUtils.addLabKeyDependency(project: project, config: "modules", depProjectPath: ":server:modules:LabDevKitModules:LDK", depProjectConfig: "published", depExtension: "module") +} diff --git a/BaseStudy/module.properties b/BaseStudy/module.properties new file mode 100644 index 000000000..60a618ba8 --- /dev/null +++ b/BaseStudy/module.properties @@ -0,0 +1,7 @@ +ModuleClass: org.labkey.basestudy.BaseStudyModule +Label: Base Study Module +Description: A module designed to support study modules +License: Apache 2.0 +LicenseURL: http://www.apache.org/licenses/LICENSE-2.0 +ManageVersion: false +SupportedDatabases: mssql, pgsql diff --git a/BaseStudy/resources/data/amount_units.tsv b/BaseStudy/resources/data/amount_units.tsv new file mode 100644 index 000000000..b4b010264 --- /dev/null +++ b/BaseStudy/resources/data/amount_units.tsv @@ -0,0 +1,11 @@ +value +g +IU +U +mEq +mg +no units +ug +units +L/min +% \ No newline at end of file diff --git a/BaseStudy/resources/data/calculated_status_codes.tsv b/BaseStudy/resources/data/calculated_status_codes.tsv new file mode 100644 index 000000000..d2bf1dec4 --- /dev/null +++ b/BaseStudy/resources/data/calculated_status_codes.tsv @@ -0,0 +1,6 @@ +value +Alive +Dead +No Record +Shipped +Unknown \ No newline at end of file diff --git a/BaseStudy/resources/data/conc_units.tsv b/BaseStudy/resources/data/conc_units.tsv new file mode 100644 index 000000000..d7d9b4d18 --- /dev/null +++ b/BaseStudy/resources/data/conc_units.tsv @@ -0,0 +1,12 @@ +value denominator numerator +g/ml mL g +g/tsp tsp g +IU/ml mL IU +mEq/ml mL mEq +mg/capsule capsule(s) mg +mg/ml mL mg +mg/piece piece(s) mg +mg/tablet tablet(s) mg +mg/tsp tsp mg +ug/ml mL ug +units/ml mL units \ No newline at end of file diff --git a/BaseStudy/resources/data/dosage_units.tsv b/BaseStudy/resources/data/dosage_units.tsv new file mode 100644 index 000000000..eb8de1491 --- /dev/null +++ b/BaseStudy/resources/data/dosage_units.tsv @@ -0,0 +1,11 @@ +value numerator denominator +g/kg g kg +IU/kg IU kg +mEq/kg mEq kg +mg/animal mg +mg/kg mg kg +ml/kg ml kg +no units +ounces/kg ounces kg +ug/kg ug kg +units/kg units kg \ No newline at end of file diff --git a/BaseStudy/resources/data/gender_codes.tsv b/BaseStudy/resources/data/gender_codes.tsv new file mode 100644 index 000000000..783f8712d --- /dev/null +++ b/BaseStudy/resources/data/gender_codes.tsv @@ -0,0 +1,4 @@ +value meaning origgender +f Female f +m Male m +u Unknown \ No newline at end of file diff --git a/BaseStudy/resources/data/geographic_origins.tsv b/BaseStudy/resources/data/geographic_origins.tsv new file mode 100644 index 000000000..0870abf80 --- /dev/null +++ b/BaseStudy/resources/data/geographic_origins.tsv @@ -0,0 +1,4 @@ +value +Indian +Chinese +Hybrid \ No newline at end of file diff --git a/BaseStudy/resources/data/labwork_types.tsv b/BaseStudy/resources/data/labwork_types.tsv new file mode 100644 index 000000000..20a065173 --- /dev/null +++ b/BaseStudy/resources/data/labwork_types.tsv @@ -0,0 +1,61 @@ +value title units sort_order category +GLUC Glucose mg/dL 1 Chemistry +BUN Blood urea nitrogen mg/dL 2 Chemistry +CREAT Creatinine mg/dL 3 Chemistry +CPK Creatine phosphokinase U/L 4 Chemistry +CHOL Cholesterol mg/dl 5 Chemistry +TRIG Triglyceride mg/dL 6 Chemistry +SGOT Serum glutamic oxaloacetic transaminase IU/L 7 Chemistry +LDL Low-Density Lipoprotein mg/dL 8 Chemistry +LDH Lactate dehydrogenase IU/L 9 Chemistry +TB Total Bilirubin mg/dL 10 Chemistry +GGT Gamma-glutamyltransferase IU/L 11 Chemistry +SGPT Serum glutamic pyruvic transaminase IU/L 12 Chemistry +TP Total Protein g/dL 13 Chemistry +ALB Albumin g/dL 14 Chemistry +ALKP Alkaline Phosphatase IU/L 15 Chemistry +CA Calcium mg/dL 16 Chemistry +PHOS Phosphorus mg/dL 17 Chemistry +FE Iron ?g/dL 18 Chemistry +K Potassium mmol/L 20 Chemistry +UA Uric Acid mg/dL 22 Chemistry +A/P Albumin/Protein Ratio ratio 999 Chemistry +B/C BUN/Creatinine Ratio ratio 999 Chemistry +CL Chloride mEq/L 999 Chemistry +FIBR Fibrinogen mg/dL 999 Chemistry +HDL High-Density Lipoprotein mg/dL 999 Chemistry +WBC White Blood Cells 10^3/uL 1 Hematology +NEUT% Neutrophils % 2 Hematology +BAND% Bands 3 Hematology +LYMPH% Lymphocytes % 4 Hematology +MONO% Monocytes % 5 Hematology +EOS% Eosinophils % 6 Hematology +BASO% Basophils % 7 Hematology +HCT Hematocrit % 8 Hematology +HGB Hemoglobin 9 Hematology +RBC Red Blood Cells 10^6/uL 10 Hematology +MCV Mean corpuscular volume fL 11 Hematology +MCH Mean corpuscular hemoglobin picograms 12 Hematology +MCHC Mean corpuscular hemoglobin concentration g/dL 13 Hematology +RETIC Reticulocytes % 14 Hematology +PLT Platelets 10^3/uL 15 Hematology +MYELO Myelocytes % 999 Hematology +MPV Mean platelet volume fl 999 Hematology +Anisocytosis Anisocytosis 999 Hematology +GLOB Globulin g/dL 999 Hematology +Hypochromic RBC Hypochromic RBC 999 Hematology +LUC Large unstained cells 999 Hematology +Macrocytic RBC Macrocytic RBC 999 Hematology +METAMYELO Metamyelocytes % 999 Hematology +Microcytic RBC Microcytic RBC 999 Hematology +NRBC Nucleated red blood cells 999 Hematology +PCV Packed cell volume % 999 Hematology +Polychromasia RBC Polychromasia RBC 999 Hematology +MPMN Neutrophils 999 Hematology +SEDRate Sedimentation rate 999 Hematology +RDW % 999 Hematology +NEUT# Neutrophil # 10^3/uL 16 Hematology +LYMPH# Lymphocyte # 10^3/uL 17 Hematology +MONO# Monocyte # 10^3/uL 18 Hematology +EOS# Eosinophil # 10^3/uL 19 Hematology +BASO# Basophil # 10^3/uL 20 Hematology diff --git a/BaseStudy/resources/data/lookup_sets.tsv b/BaseStudy/resources/data/lookup_sets.tsv new file mode 100644 index 000000000..d831d31b4 --- /dev/null +++ b/BaseStudy/resources/data/lookup_sets.tsv @@ -0,0 +1,11 @@ +setname label keyfield titleColumn +amount_units Amount Units unit +calculated_status_codes Calculated Status Codes code +conc_units Concentraiton Units unit +dosage_units Dosage Units unit +gender_codes Gender Codes +geographic_origins Geographic Origins origin +routes Routes route +volume_units Volume Units unit +labwork_types Lab Tests test title +vl_sample_types Lab Tests test \ No newline at end of file diff --git a/BaseStudy/resources/data/reports.tsv b/BaseStudy/resources/data/reports.tsv new file mode 100644 index 000000000..c9ba1c207 --- /dev/null +++ b/BaseStudy/resources/data/reports.tsv @@ -0,0 +1,22 @@ +reporttype category schemaname queryname viewname reporttitle subjectfieldname +query General study additionalDatatypes Additional Data +query Clinical study weight Weights +query Clinical study treatments Treatments/Medications +query Clinical study chemistryPivot Blood Chemistry +query Clinical study hematologyPivot CBC/Hematology +query Study Design study assignment Project/Study Assignment +query Research study flow Flow Cytometry +query Research study outcomes Study Outcomes/Phenotypes +query Research study pvl_outcomes Study PVL-Based Outcomes +query Research study genetics Genetic Data / MHC +query Clinical study procedures Procedures +query Research study viralLoads Viral Loads +query General study samples Samples +query Research study immunizations Immunizations +query General study flags Flags/Misc Information +query General study demographics Demographics +query General study demographics Project Summary Project Summary +query General study demographics MHC Type MHC Typing +query General study demographics Expanded Expanded Information +query Study Design studies timepointToDate Timepoints subjectId +query Study Design studies subjectAnchorDates Anchor Dates subjectId diff --git a/BaseStudy/resources/data/routes.tsv b/BaseStudy/resources/data/routes.tsv new file mode 100644 index 000000000..b0e1f0d80 --- /dev/null +++ b/BaseStudy/resources/data/routes.tsv @@ -0,0 +1,24 @@ +value title +IM +intracardiac +intracarotid +intracorneal Intracorneal +intracranial +IP intraperitoneal +ID +INH +IT +IV +CRI +IVAG +oral +PO +rectal +Spillage +SQ +OU +OD +OS +topical +topical (eye) +topical (skin) \ No newline at end of file diff --git a/BaseStudy/resources/data/species.tsv b/BaseStudy/resources/data/species.tsv new file mode 100644 index 000000000..c071b7272 --- /dev/null +++ b/BaseStudy/resources/data/species.tsv @@ -0,0 +1,10 @@ +common_name scientific_name id_prefix mhc_prefix blood_per_kg max_draw_pct blood_draw_interval cites_code dateDisabled +Baboon 60 0.2 30 +Cotton-top Tamarin Saguinus oedipus so Saoe 60 0.2 30 +Cynomolgus Macaca fascicularis cy Mafa 60 0.2 30 +Marmoset Callithrix jacchus cj Caja 60 0.15 30 +Pigtail Macaca Nemestrina Mane 60 0.2 30 +Rhesus Macaca mulatta r|rh Mamu 60 0.2 30 +Sooty Mangabey Cercocebus atys Ceat 60 0.2 30 +Stump Tailed Macaca Arctoides Maar 60 0.2 30 +Vervet Chlorocebus sabaeus ag Chsa 60 0.2 30 diff --git a/BaseStudy/resources/data/vl_sample_types.tsv b/BaseStudy/resources/data/vl_sample_types.tsv new file mode 100644 index 000000000..51943b0b3 --- /dev/null +++ b/BaseStudy/resources/data/vl_sample_types.tsv @@ -0,0 +1,3 @@ +value +Plasma +Cells \ No newline at end of file diff --git a/BaseStudy/resources/data/volume_units.tsv b/BaseStudy/resources/data/volume_units.tsv new file mode 100644 index 000000000..fc2c76822 --- /dev/null +++ b/BaseStudy/resources/data/volume_units.tsv @@ -0,0 +1,13 @@ +value +capsule(s) +cup +drop(s) +cube +mL +mL/hr +no units +ounce(s) +pan +piece(s) +tablet(s) +tsp \ No newline at end of file diff --git a/BaseStudy/resources/queries/laboratory/reports.js b/BaseStudy/resources/queries/laboratory/reports.js new file mode 100644 index 000000000..c6f5589e9 --- /dev/null +++ b/BaseStudy/resources/queries/laboratory/reports.js @@ -0,0 +1,11 @@ +function afterInsert() { + org.labkey.api.laboratory.LaboratoryService.get().clearDataProviderCache(); +} + +function afterUpdate() { + org.labkey.api.laboratory.LaboratoryService.get().clearDataProviderCache(); +} + +function afterDelete() { + org.labkey.api.laboratory.LaboratoryService.get().clearDataProviderCache(); +} \ No newline at end of file diff --git a/BaseStudy/resources/queries/study/additionalDatatypes.query.xml b/BaseStudy/resources/queries/study/additionalDatatypes.query.xml new file mode 100644 index 000000000..7efac0999 --- /dev/null +++ b/BaseStudy/resources/queries/study/additionalDatatypes.query.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + Category + + + Accession #(s) + + org.labkey.studies.query.AccessionsDisplayColumnFactory + + + + Data Source + + + Description + + + Comments + + +
+
+
+
\ No newline at end of file diff --git a/BaseStudy/resources/queries/study/assignment.query.xml b/BaseStudy/resources/queries/study/assignment.query.xml new file mode 100644 index 000000000..f7e42cfd5 --- /dev/null +++ b/BaseStudy/resources/queries/study/assignment.query.xml @@ -0,0 +1,49 @@ + + + + + + + + Start Date + Date + + + End Date + Date + + + Study Name + + + Cohort ID + + studies + studyCohorts + rowId + studyAndCohort + + + + + Sub-Group + + + + Cohort Alias + + + Data Source + + + Category + + + Description + true + + +
+
+
+
diff --git a/BaseStudy/resources/queries/study/chemistryPivot.query.xml b/BaseStudy/resources/queries/study/chemistryPivot.query.xml new file mode 100644 index 000000000..92c8a7384 --- /dev/null +++ b/BaseStudy/resources/queries/study/chemistryPivot.query.xml @@ -0,0 +1,20 @@ + + + + + Chemistry Results + + + + http://cpas.labkey.com/Study#ParticipantId + + study + animal + Id + + + +
+
+
+
\ No newline at end of file diff --git a/BaseStudy/resources/queries/study/chemistryPivot.sql b/BaseStudy/resources/queries/study/chemistryPivot.sql new file mode 100644 index 000000000..139f2cb9e --- /dev/null +++ b/BaseStudy/resources/queries/study/chemistryPivot.sql @@ -0,0 +1,24 @@ +SELECT + b.Id, + b.date, + b.method, + b.test, + group_concat(b.result) as result + +FROM (SELECT + b.Id, + b.date, + b.test, + b.method, + CASE + WHEN b.result IS NULL THEN b.qualresult + ELSE CAST(CAST(b.result AS float) AS VARCHAR) + END as result + FROM study.labwork b + WHERE b.test.category = 'Chemistry' AND b.test.sort_order != 999 +) b + +GROUP BY b.id, b.date, b.test, b.method +PIVOT result BY test IN (select value from studies.labwork_types t WHERE t.sort_order != 999 AND t.category = 'Chemistry' order by sort_order) + + diff --git a/BaseStudy/resources/queries/study/demographics.query.xml b/BaseStudy/resources/queries/study/demographics.query.xml new file mode 100644 index 000000000..2a019cc9f --- /dev/null +++ b/BaseStudy/resources/queries/study/demographics.query.xml @@ -0,0 +1,72 @@ + + + + + + + f + + + + + true + + + true + false + + + Date + Birth + /query/executeQuery.view? + schemaName=study& + query.queryName=Birth& + query.Id~eq=${Id} + + + + Date + Death + /query/executeQuery.view? + schemaName=study& + query.queryName=Deaths& + query.Id~eq=${Id} + + + + true + true + false + + + Sex + + + Geographic Origin + + + Birth + + + Death + + + Species + + + Mother/Dam + + + Father/Sire + + + Status + + + Data Source + + +
+
+
+
\ No newline at end of file diff --git a/BaseStudy/resources/queries/study/demographicsImmunizations.query.xml b/BaseStudy/resources/queries/study/demographicsImmunizations.query.xml new file mode 100644 index 000000000..bd3587c51 --- /dev/null +++ b/BaseStudy/resources/queries/study/demographicsImmunizations.query.xml @@ -0,0 +1,26 @@ + + + + + Immunization Summary + + + true + true + + + Immunizations + /query/executeQuery.view?schemaName=study&query.queryName=immunizations&query.Id~eq=${Id} + _blank + + + Immunization Types + /query/executeQuery.view?schemaName=study&query.queryName=immunizations&query.Id~eq=${Id} + _blank + + + immunizations +
+
+
+
diff --git a/BaseStudy/resources/queries/study/demographicsImmunizations.sql b/BaseStudy/resources/queries/study/demographicsImmunizations.sql new file mode 100644 index 000000000..4f28d89b5 --- /dev/null +++ b/BaseStudy/resources/queries/study/demographicsImmunizations.sql @@ -0,0 +1,7 @@ +SELECT + s.Id, + group_concat(DISTINCT COALESCE(s.backbone, s.treatment), char(10)) as immunizations, + group_concat(DISTINCT s.category, char(10)) as immunizationTypes, + +FROM study.immunizations s +GROUP BY s.Id \ No newline at end of file diff --git a/BaseStudy/resources/queries/study/demographicsMHC.query.xml b/BaseStudy/resources/queries/study/demographicsMHC.query.xml new file mode 100644 index 000000000..e07992b49 --- /dev/null +++ b/BaseStudy/resources/queries/study/demographicsMHC.query.xml @@ -0,0 +1,31 @@ + + + + + MHC Genotype + + + true + true + + + All MHC Alleles + + + Mamu-A01 + + + Mamu-A02 + + + Mamu-B08 + + + Mamu-B17 + + + allAlleles +
+
+
+
diff --git a/BaseStudy/resources/queries/study/demographicsMHC.sql b/BaseStudy/resources/queries/study/demographicsMHC.sql new file mode 100644 index 000000000..45f842b4a --- /dev/null +++ b/BaseStudy/resources/queries/study/demographicsMHC.sql @@ -0,0 +1,29 @@ +SELECT + s.Id, + count(s.Id) as totalTests, + group_concat(DISTINCT s.assayType) as assayTypes, + + --special case A01/B17/B08 + max(CASE + WHEN (s.marker = 'Mamu-A1*001g' AND (s.result = 'POS' OR s.result = 'NEG')) THEN s.result + ELSE null + END) as A01, + + max(CASE + WHEN (s.marker = 'Mamu-A1*002g' AND (s.result = 'POS' OR s.result = 'NEG')) THEN s.result + ELSE null + END) as A02, + + max(CASE + WHEN (s.marker = 'Mamu-B*008g' AND (s.result = 'POS' OR s.result = 'NEG')) THEN s.result + ELSE '' + END) as B08, + + max(CASE + WHEN (s.marker = 'Mamu-B*017g' AND (s.result = 'POS' OR s.result = 'NEG')) THEN s.result + ELSE '' + END) as B17, + GROUP_CONCAT(distinct CASE WHEN s.result = 'POS' THEN s.marker ELSE null END, char(10)) as allAlleles +FROM study.genetics s +WHERE s.category = 'MHC Typing' +GROUP BY s.Id \ No newline at end of file diff --git a/BaseStudy/resources/queries/study/demographicsOutcomes.query.xml b/BaseStudy/resources/queries/study/demographicsOutcomes.query.xml new file mode 100644 index 000000000..22acc4fac --- /dev/null +++ b/BaseStudy/resources/queries/study/demographicsOutcomes.query.xml @@ -0,0 +1,19 @@ + + + + + Outcome Summary + + + true + true + + + Outcomes + + + outcomes +
+
+
+
diff --git a/BaseStudy/resources/queries/study/demographicsOutcomes.sql b/BaseStudy/resources/queries/study/demographicsOutcomes.sql new file mode 100644 index 000000000..22ffd948f --- /dev/null +++ b/BaseStudy/resources/queries/study/demographicsOutcomes.sql @@ -0,0 +1,6 @@ +SELECT + s.Id, + group_concat(DISTINCT s.outcome, char(10)) as outcomes + +FROM study.outcomes s +GROUP BY s.Id \ No newline at end of file diff --git a/BaseStudy/resources/queries/study/demographicsProjects.query.xml b/BaseStudy/resources/queries/study/demographicsProjects.query.xml new file mode 100644 index 000000000..11e8665c4 --- /dev/null +++ b/BaseStudy/resources/queries/study/demographicsProjects.query.xml @@ -0,0 +1,34 @@ + + + + + Project Summary + + + true + true + + + Study Categories + + + Studies + /query/executeQuery.view?schemaName=study&query.queryName=assignment&query.Id~eq=${Id} + _blank + + + Studies and Analyses + + + Analysis Groups + 150 + + + Subgroups/Treatments + + + categories +
+
+
+
diff --git a/BaseStudy/resources/queries/study/demographicsProjects.sql b/BaseStudy/resources/queries/study/demographicsProjects.sql new file mode 100644 index 000000000..b54d15915 --- /dev/null +++ b/BaseStudy/resources/queries/study/demographicsProjects.sql @@ -0,0 +1,12 @@ +SELECT + s.Id, + count(s.Id) as totalProjects, + group_concat(DISTINCT s.study, char(10)) as allStudiesAndAnalyses, + group_concat(DISTINCT CASE WHEN s.category = 'Analysis Cohorts' THEN NULL ELSE s.study END, char(10)) as allStudies, + group_concat(DISTINCT CASE WHEN s.category = 'Analysis Cohorts' THEN s.study ELSE NULL END, char(10)) as analysisGroups, + group_concat(DISTINCT s.cohortId.studyId.description, char(10)) as studyDescription, + group_concat(DISTINCT s.category, char(10)) as categories, + group_concat(DISTINCT s.subgroup, char(10)) as subgroups + +FROM study.assignment s +GROUP BY s.Id \ No newline at end of file diff --git a/BaseStudy/resources/queries/study/flags.query.xml b/BaseStudy/resources/queries/study/flags.query.xml new file mode 100644 index 000000000..23071f2b8 --- /dev/null +++ b/BaseStudy/resources/queries/study/flags.query.xml @@ -0,0 +1,25 @@ + + + + + + + + Start Date + Date + + + End Date + Date + + + Flag + + + Data Source + + +
+
+
+
diff --git a/BaseStudy/resources/queries/study/flow.query.xml b/BaseStudy/resources/queries/study/flow.query.xml new file mode 100644 index 000000000..3ca630fea --- /dev/null +++ b/BaseStudy/resources/queries/study/flow.query.xml @@ -0,0 +1,46 @@ + + + + + Flow Cytometry + + + + Start Date + Date + + + Tissue + + + Sample Type + + + Assay Type + + + Population + + + Parent Population + + + % of Parent + + + Absolute Count + + + Units + + + Comments + + + Data Source + + +
+
+
+
diff --git a/BaseStudy/resources/queries/study/genetics.query.xml b/BaseStudy/resources/queries/study/genetics.query.xml new file mode 100644 index 000000000..07774ea71 --- /dev/null +++ b/BaseStudy/resources/queries/study/genetics.query.xml @@ -0,0 +1,40 @@ + + + + + + + + Date + Date + + + Category + + + Assay Type + + + Library Type + + + Marker/Allele + + + Result + + + Score + + + Comments + textarea + + + Data Source + + +
+
+
+
diff --git a/BaseStudy/resources/queries/study/genomicsDataSource.sql b/BaseStudy/resources/queries/study/genomicsDataSource.sql new file mode 100644 index 000000000..38d6b4454 --- /dev/null +++ b/BaseStudy/resources/queries/study/genomicsDataSource.sql @@ -0,0 +1,16 @@ +SELECT + +s1.subjectId as Id, +s1.date, + +('Assay(s): ' || application) as description, +'ONPRC Genetics Core' as dataSource + +FROM (SELECT + s.subjectId, + coalesce(s.sampleDate, now()) as date, + GROUP_CONCAT(DISTINCT s.application, ', ') as application + + FROM "/Internal/ColonyData".sequenceanalysis.sequence_readsets s + GROUP BY s.subjectId, s.sampleDate +) s1 \ No newline at end of file diff --git a/BaseStudy/resources/queries/study/hematologyPivot.query.xml b/BaseStudy/resources/queries/study/hematologyPivot.query.xml new file mode 100644 index 000000000..92d4b22f6 --- /dev/null +++ b/BaseStudy/resources/queries/study/hematologyPivot.query.xml @@ -0,0 +1,20 @@ + + + + + Hematology Results + + + + http://cpas.labkey.com/Study#ParticipantId + + study + animal + Id + + + +
+
+
+
\ No newline at end of file diff --git a/BaseStudy/resources/queries/study/hematologyPivot.sql b/BaseStudy/resources/queries/study/hematologyPivot.sql new file mode 100644 index 000000000..c15d59969 --- /dev/null +++ b/BaseStudy/resources/queries/study/hematologyPivot.sql @@ -0,0 +1,24 @@ +SELECT + b.Id, + b.date, + b.method, + b.test, + group_concat(b.result) as result + +FROM (SELECT + b.Id, + b.date, + b.test, + b.method, + CASE + WHEN b.result IS NULL THEN b.qualresult + ELSE CAST(CAST(b.result AS float) AS VARCHAR) + END as result + FROM study.labwork b + WHERE b.test.category = 'Hematology' AND b.test.sort_order != 999 +) b + +GROUP BY b.id, b.date, b.test, b.method +PIVOT result BY test IN (select value from studies.labwork_types t WHERE t.sort_order != 999 AND t.category = 'Hematology' order by sort_order) + + diff --git a/BaseStudy/resources/queries/study/immunizations.query.xml b/BaseStudy/resources/queries/study/immunizations.query.xml new file mode 100644 index 000000000..2fc7f169d --- /dev/null +++ b/BaseStudy/resources/queries/study/immunizations.query.xml @@ -0,0 +1,53 @@ + + + + + Immunizations/Vaccinations + + + + Date + Date + + + Category + + + Treatment + + + Vector Backbone + + + Antigens + + + Route + + + Quantity + + + Quantity Units + + + Reason + + + Vector ID + + + Is Mock? + + + Comments + textarea + + + Data Source + + +
+
+
+
\ No newline at end of file diff --git a/BaseStudy/resources/queries/study/labwork.query.xml b/BaseStudy/resources/queries/study/labwork.query.xml new file mode 100644 index 000000000..1cb7b4022 --- /dev/null +++ b/BaseStudy/resources/queries/study/labwork.query.xml @@ -0,0 +1,59 @@ + + + + + + + + Date + Date + + + Category + + + Test + + studies + labwork_types + value + + + + + Result + + + Units + + + Qualitative Result + true + false + + + Method + + + Comments + textarea + + + Data Source + + + Result OOR Indicator + true + + + true + + + Result In Range? + true + + +
+
+
+
diff --git a/BaseStudy/resources/queries/study/outcomes.query.xml b/BaseStudy/resources/queries/study/outcomes.query.xml new file mode 100644 index 000000000..59e38fcac --- /dev/null +++ b/BaseStudy/resources/queries/study/outcomes.query.xml @@ -0,0 +1,27 @@ + + + + + + + + Date + Date + + + Outcome/Phenotype + + + Sub-Outcome + + + Comments + + + Data Source + + +
+
+
+
diff --git a/BaseStudy/resources/queries/study/procedures.query.xml b/BaseStudy/resources/queries/study/procedures.query.xml new file mode 100644 index 000000000..1f5446fe1 --- /dev/null +++ b/BaseStudy/resources/queries/study/procedures.query.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + Category + + + Procedure + + + Comments + textarea + + + Data Source + + +
+
+
+
\ No newline at end of file diff --git a/BaseStudy/resources/queries/study/samples.query.xml b/BaseStudy/resources/queries/study/samples.query.xml new file mode 100644 index 000000000..3d5fc433c --- /dev/null +++ b/BaseStudy/resources/queries/study/samples.query.xml @@ -0,0 +1,49 @@ + + + + + + + + Date + Date + + + Sample ID + + + Sample Type + + + Preservation + + + Quantity + + + Quantity Units + + + Freezer + + + Rack + + + Box + + + Position + + + Comments + textarea + + + Data Source + + +
+
+
+
\ No newline at end of file diff --git a/BaseStudy/resources/queries/study/scRNAseqDataSource.sql b/BaseStudy/resources/queries/study/scRNAseqDataSource.sql new file mode 100644 index 000000000..2517b709b --- /dev/null +++ b/BaseStudy/resources/queries/study/scRNAseqDataSource.sql @@ -0,0 +1,20 @@ +SELECT + +s1.subjectId as Id, +s1.date, + +('Assay(s): ' || assayType || char(10) || +'Tissue(s): ' || tissue || char(10) || +'Stims(s): ' || stims || char(10)) as description, +'Bimber Lab' as dataSource + +FROM (SELECT + s.subjectId, + s.sampleDate as date, + GROUP_CONCAT(DISTINCT s.tissue, ', ') as tissue, + GROUP_CONCAT(DISTINCT s.assayType, ', ') as assayType, + GROUP_CONCAT(DISTINCT s.stim, ', ') as stims + + FROM "/Labs/Bimber".singlecell.samples s + GROUP BY s.subjectId, s.sampleDate +) s1 \ No newline at end of file diff --git a/BaseStudy/resources/queries/study/studyData.query.xml b/BaseStudy/resources/queries/study/studyData.query.xml new file mode 100644 index 000000000..ab97c463c --- /dev/null +++ b/BaseStudy/resources/queries/study/studyData.query.xml @@ -0,0 +1,48 @@ + + + + + + + + http://cpas.labkey.com/Study#ParticipantId + laboratory/dataBrowser.view?subjectId=${Id} + ALWAYS_OFF + + + Date + + + End Date + + + Key + true + true + false + + + true + + + true + + + true + + + + + + + +
+
+
+
\ No newline at end of file diff --git a/BaseStudy/resources/queries/study/treatments.query.xml b/BaseStudy/resources/queries/study/treatments.query.xml new file mode 100644 index 000000000..b053767c0 --- /dev/null +++ b/BaseStudy/resources/queries/study/treatments.query.xml @@ -0,0 +1,79 @@ + + + + + + + + Date + Date + + + End Date + Date + + + Category + + + Treatment + + + Route + + + Frequency + + + Amount + + + Amount Units + + + Volume + true + false + + + Volume Units + true + false + + + Concentration + true + false + + + Conc. Units + true + false + + + Dosage + true + false + + + Dosage Units + true + false + + + Reason + true + false + + + Comments + textarea + + + Data Source + + +
+
+
+
diff --git a/BaseStudy/resources/queries/study/weight.query.xml b/BaseStudy/resources/queries/study/weight.query.xml new file mode 100644 index 000000000..4550e2556 --- /dev/null +++ b/BaseStudy/resources/queries/study/weight.query.xml @@ -0,0 +1,23 @@ + + + + + + + + + + true + + + Weight (kg) + 0.#### + + + Data Source + + +
+
+
+
\ No newline at end of file diff --git a/BaseStudy/resources/referenceStudy/folder.xml b/BaseStudy/resources/referenceStudy/folder.xml new file mode 100644 index 000000000..e3acbb155 --- /dev/null +++ b/BaseStudy/resources/referenceStudy/folder.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/BaseStudy/resources/referenceStudy/study/datasets/Studies.dataset b/BaseStudy/resources/referenceStudy/study/datasets/Studies.dataset new file mode 100644 index 000000000..8e5970288 --- /dev/null +++ b/BaseStudy/resources/referenceStudy/study/datasets/Studies.dataset @@ -0,0 +1,19 @@ +# default group can be used to avoid repeating definitions for each dataset +# +# action=[REPLACE,APPEND,DELETE] (default:REPLACE) +# deleteAfterImport=[TRUE|FALSE] (default:FALSE) + +default.action=REPLACE +default.deleteAfterImport=FALSE + +# map a source tsv column (right side) to a property name or full propertyURI (left) +# predefined properties: ParticipantId, SiteId, VisitId, Created +default.property.ParticipantId=ptid +default.property.Created=dfcreate + +# use to map from filename->datasetid +# NOTE: if there are NO explicit import definitions, we will try to import all files matching pattern +# NOTE: if there are ANY explicit mapping, we will only import listed datasets + +default.filePattern=dataset(\\d*).tsv +default.importAllMatches=TRUE diff --git a/BaseStudy/resources/referenceStudy/study/datasets/datasets_manifest.xml b/BaseStudy/resources/referenceStudy/study/datasets/datasets_manifest.xml new file mode 100644 index 000000000..12d37227d --- /dev/null +++ b/BaseStudy/resources/referenceStudy/study/datasets/datasets_manifest.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BaseStudy/resources/referenceStudy/study/datasets/datasets_metadata.xml b/BaseStudy/resources/referenceStudy/study/datasets/datasets_metadata.xml new file mode 100644 index 000000000..259df5f6b --- /dev/null +++ b/BaseStudy/resources/referenceStudy/study/datasets/datasets_metadata.xml @@ -0,0 +1,626 @@ + + + + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + + timestamp + http://cpas.labkey.com/laboratory#sampleDate + + + varchar + + + entityid + true + + + + timestamp + + + varchar + + + Flags/Misc Information +
+ + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + + timestamp + http://cpas.labkey.com/laboratory#sampleDate + + + varchar + + + entityid + true + + + + timestamp + + + varchar + + + varchar + + + double + + + varchar + + + double + + + varchar + + + double + + + varchar + + + varchar + + + integer + + + double + + + varchar + + + varchar + + + varchar + + + Medications/Treatments +
+ + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + + timestamp + http://cpas.labkey.com/laboratory#sampleDate + + + varchar + + + entityid + true + + + varchar + + + varchar + + + varchar + + + varchar + + + varchar + + + double + + + varchar + + + varchar + + + boolean + + + integer + + + varchar + + + Immunizations +
+ + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + + timestamp + http://cpas.labkey.com/laboratory#sampleDate + + + varchar + + + entityid + true + + + + double + + + Weight +
+ + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + + timestamp + http://cpas.labkey.com/laboratory#sampleDate + + + varchar + + + entityid + true + + + + varchar + + + varchar + + + varchar + + + double + + + double + + + varchar + true + + org.labkey.api.studies.query.ResultsOORDisplayColumn + + + + varchar + + + varchar + + + varchar + + + Viral Loads +
+ + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + + timestamp + http://cpas.labkey.com/laboratory#sampleDate + + + varchar + + + entityid + true + + + varchar + + + varchar + + + varchar + + + varchar + + + double + + + varchar + + + varchar + + + varchar + + + varchar + + + varchar + + + Lab Results +
+ + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + + timestamp + http://cpas.labkey.com/laboratory#sampleDate + + + varchar + + + entityid + false + + + + varchar + + + varchar + + + timestamp + + + timestamp + + + varchar + + + varchar + + + varchar + + + varchar + + + Demographics +
+ + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + + timestamp + http://cpas.labkey.com/laboratory#sampleDate + + + varchar + + + entityid + true + + + + timestamp + + + varchar + + + varchar + + + varchar + + + varchar + + + integer + + + varchar + + + Project Assignment +
+ + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + + timestamp + http://cpas.labkey.com/laboratory#sampleDate + + + varchar + + + entityid + true + + + + varchar + + + varchar + + + varchar + + + double + + + varchar + + + varchar + + + varchar + + + varchar + + + varchar + + + varchar + + + Samples +
+ + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + + timestamp + http://cpas.labkey.com/laboratory#sampleDate + + + varchar + + + entityid + true + + + varchar + + + varchar + + + varchar + + + varchar + + + varchar + + + double + + + varchar + + + Genetic Data +
+ + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + + timestamp + http://cpas.labkey.com/laboratory#sampleDate + + + varchar + + + entityid + true + + + varchar + + + varchar + + + varchar + + + Procedures +
+ + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + + timestamp + http://cpas.labkey.com/laboratory#sampleDate + + + varchar + + + entityid + true + + + varchar + + + varchar + + + varchar + + + Additional Datatypes +
+ + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + + timestamp + http://cpas.labkey.com/laboratory#sampleDate + + + varchar + + + entityid + true + + + varchar + + + varchar + + + varchar + + + varchar + + + varchar + + + double + + + double + + + varchar + + + varchar + + + Flow Cytometry +
+ + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + + timestamp + http://cpas.labkey.com/laboratory#sampleDate + + + varchar + + + entityid + true + + + varchar + + + varchar + + + varchar + + + Outcomes/Phenotypes +
+ + + + varchar + http://cpas.labkey.com/Study#ParticipantId + + + timestamp + http://cpas.labkey.com/laboratory#sampleDate + + + timestamp + + + varchar + + + entityid + true + + + varchar + + + double + + + varchar + + + integer + + + varchar + + + PVL Outcomes +
+
diff --git a/BaseStudy/resources/referenceStudy/study/study.xml b/BaseStudy/resources/referenceStudy/study/study.xml new file mode 100644 index 000000000..0acc6d7dc --- /dev/null +++ b/BaseStudy/resources/referenceStudy/study/study.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/BaseStudy/resources/referenceStudy/study/studyPolicy.xml b/BaseStudy/resources/referenceStudy/study/studyPolicy.xml new file mode 100644 index 000000000..3755d25b8 --- /dev/null +++ b/BaseStudy/resources/referenceStudy/study/studyPolicy.xml @@ -0,0 +1,10 @@ + + + BASIC_WRITE + + + + + + + \ No newline at end of file diff --git a/BaseStudy/resources/schemas/basestudy.xml b/BaseStudy/resources/schemas/basestudy.xml new file mode 100644 index 000000000..6bd9f222b --- /dev/null +++ b/BaseStudy/resources/schemas/basestudy.xml @@ -0,0 +1,20 @@ + + + \ No newline at end of file diff --git a/BaseStudy/resources/schemas/dbscripts/postgresql/basestudy-26.000-26.001.sql b/BaseStudy/resources/schemas/dbscripts/postgresql/basestudy-26.000-26.001.sql new file mode 100644 index 000000000..a06573945 --- /dev/null +++ b/BaseStudy/resources/schemas/dbscripts/postgresql/basestudy-26.000-26.001.sql @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2026 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +-- Create schema, tables, indexes, and constraints used for BaseStudy module here +-- All SQL VIEW definitions should be created in basestudy-create.sql and dropped in basestudy-drop.sql +CREATE SCHEMA basestudy; diff --git a/BaseStudy/src/org/labkey/basestudy/BaseStudyController.java b/BaseStudy/src/org/labkey/basestudy/BaseStudyController.java new file mode 100644 index 000000000..ac889ebcb --- /dev/null +++ b/BaseStudy/src/org/labkey/basestudy/BaseStudyController.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2026 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.labkey.basestudy; + +import org.labkey.api.action.SimpleViewAction; +import org.labkey.api.action.SpringActionController; +import org.labkey.api.security.RequiresPermission; +import org.labkey.api.security.permissions.ReadPermission; +import org.labkey.api.view.JspView; +import org.labkey.api.view.NavTree; +import org.springframework.validation.BindException; +import org.springframework.web.servlet.ModelAndView; + +public class BaseStudyController extends SpringActionController +{ + private static final DefaultActionResolver _actionResolver = new DefaultActionResolver(BaseStudyController.class); + public static final String NAME = "basestudy"; + + public BaseStudyController() + { + setActionResolver(_actionResolver); + } +} diff --git a/BaseStudy/src/org/labkey/basestudy/BaseStudyManager.java b/BaseStudy/src/org/labkey/basestudy/BaseStudyManager.java new file mode 100644 index 000000000..9169e3e77 --- /dev/null +++ b/BaseStudy/src/org/labkey/basestudy/BaseStudyManager.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2026 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.labkey.basestudy; + +public class BaseStudyManager +{ + private static final BaseStudyManager _instance = new BaseStudyManager(); + + private BaseStudyManager() + { + // prevent external construction with a private default constructor + } + + public static BaseStudyManager get() + { + return _instance; + } +} \ No newline at end of file diff --git a/BaseStudy/src/org/labkey/basestudy/BaseStudyModule.java b/BaseStudy/src/org/labkey/basestudy/BaseStudyModule.java new file mode 100644 index 000000000..ae9040bac --- /dev/null +++ b/BaseStudy/src/org/labkey/basestudy/BaseStudyModule.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2026 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.labkey.basestudy; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.labkey.api.data.Container; +import org.labkey.api.data.ContainerManager; +import org.labkey.api.module.DefaultModule; +import org.labkey.api.module.ModuleContext; +import org.labkey.api.view.WebPartFactory; + +import java.util.Collection; +import java.util.Collections; +import java.util.Set; + +public class BaseStudyModule extends DefaultModule +{ + public static final String NAME = "BaseStudy"; + + @Override + public String getName() + { + return NAME; + } + + @Override + public @Nullable Double getSchemaVersion() + { + return 26.001; + } + + @Override + public boolean hasScripts() + { + return true; + } + + @Override + @NotNull + protected Collection createWebPartFactories() + { + return Collections.emptyList(); + } + + @Override + protected void init() + { + addController(BaseStudyController.NAME, BaseStudyController.class); + } + + @Override + public void doStartup(ModuleContext moduleContext) + { + } + + @Override + @NotNull + public Collection getSummary(Container c) + { + return Collections.emptyList(); + } + + @Override + @NotNull + public Set getSchemaNames() + { + return Collections.singleton(BaseStudySchema.NAME); + } +} \ No newline at end of file diff --git a/BaseStudy/src/org/labkey/basestudy/BaseStudySchema.java b/BaseStudy/src/org/labkey/basestudy/BaseStudySchema.java new file mode 100644 index 000000000..fed023cb4 --- /dev/null +++ b/BaseStudy/src/org/labkey/basestudy/BaseStudySchema.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2026 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.labkey.basestudy; + +import org.labkey.api.data.DbSchema; +import org.labkey.api.data.DbSchemaType; +import org.labkey.api.data.dialect.SqlDialect; + +public class BaseStudySchema +{ + private static final BaseStudySchema _instance = new BaseStudySchema(); + public static final String NAME = "basestudy"; + + public static BaseStudySchema getInstance() + { + return _instance; + } + + private BaseStudySchema() + { + // private constructor to prevent instantiation from + // outside this class: this singleton should only be + // accessed via org.labkey.basestudy.BaseStudySchema.getInstance() + } + + public DbSchema getSchema() + { + return DbSchema.get(NAME, DbSchemaType.Module); + } + + public SqlDialect getSqlDialect() + { + return getSchema().getSqlDialect(); + } +}