diff --git a/cumulus_library_covid/covid_symptom/count_covid_pcr.sql b/cumulus_library_covid/covid_symptom/count_pcr.sql similarity index 94% rename from cumulus_library_covid/covid_symptom/count_covid_pcr.sql rename to cumulus_library_covid/covid_symptom/count_pcr.sql index aceefd7..bf18374 100644 --- a/cumulus_library_covid/covid_symptom/count_covid_pcr.sql +++ b/cumulus_library_covid/covid_symptom/count_pcr.sql @@ -42,6 +42,9 @@ WHERE '10828004', 'Positive', 'POSITIVE' )); +-- # TODO i2b2 specific lab result codes are hardcoded, should be covid_symptom__define_pcr +-- https://github.com/smart-on-fhir/cumulus-etl/issues/231 + -- ############################################################################ diff --git a/cumulus_library_covid/covid_symptom/covid_define.sql b/cumulus_library_covid/covid_symptom/covid_define.sql index 93ca7fa..035cf7d 100644 --- a/cumulus_library_covid/covid_symptom/covid_define.sql +++ b/cumulus_library_covid/covid_symptom/covid_define.sql @@ -11,29 +11,6 @@ -- https://www.nlm.nih.gov/vsac/support/usingvsac/covid19valuesets.html -- http://build.fhir.org/ig/HL7/fhir-COVID19Library-ig/ValueSet-covid19-pos-neg-inv-vs.html --- ############################################################################ --- COVID19 PCR - -CREATE OR REPLACE VIEW covid_symptom__define_pcr AS -SELECT - t.code_system, - t.code, - t.display -FROM - ( - VALUES - ( - 'http://loinc.org', - '94500-6', - 'SARS-CoV-2 (COVID-19) RNA [Presence] in Respiratory specimen by NAA with probe detection' --noqa:LT05 - ), - ( - 'http://loinc.org', - '95406-5', - 'SARS-CoV-2 (COVID-19) RNA [Presence] in Nose by NAA with probe detection' - ) - ) AS t (code_system, code, display); - CREATE OR REPLACE VIEW covid_symptom__define_pcr_result AS SELECT t.code_system, @@ -86,60 +63,3 @@ FROM ( ('C0242429', 'Sore throat') ) AS t (cui, pref); - - --- ############################################################################ --- COVID19 Age Groups (primarily for Suicidality study) - -CREATE OR REPLACE VIEW covid_symptom__define_age AS -SELECT - t.age, - t.age_group -FROM - ( - VALUES - (0, '<5'), - (1, '<5'), - (2, '<5'), - (3, '<5'), - (4, '<5'), - (5, '=>5'), - (6, '=>5'), - (7, '=>5'), - (8, '=>5'), - (9, '=>5'), - (10, '=>5'), - (11, '=>5'), - (12, '=>5'), - (13, '=>5'), - (14, '=>5'), - (15, '=>5'), - (16, '=>5'), - (17, '=>5'), - (18, '=>5'), - (19, '=>5'), - (20, '=>5'), - (21, '=>5') - ) AS t (age, age_group); - --- ############################################################################ --- COVID19 Study Period for Variant Eras --- --- Variant eras are defined using COVID-19 data for Massachusetts from CoVariant [16]. --- Pre-Delta era was defined as March 1, 2020 to June 20, 2021 --- Delta era as June 21, 2021 to December 19, 2021 --- Omicron era as December 20, 2021 onwards. - -CREATE OR REPLACE VIEW covid_symptom__define_period AS -SELECT - t.variant_era, - t.variant_start, - t.variant_end -FROM ( - VALUES - -- ('before-covid', date('2020-02-29'), date('2021-02-28')) - ('before-delta', date('2020-03-01'), date('2021-06-20')), - ('delta', date('2021-06-21'), date('2021-12-19')), - ('omicron', date('2021-12-20'), date('2022-06-01')) -) -AS t (variant_era, variant_start, variant_end); diff --git a/cumulus_library_covid/covid_symptom/define_pcr_loinc.sql b/cumulus_library_covid/covid_symptom/define_pcr.sql similarity index 100% rename from cumulus_library_covid/covid_symptom/define_pcr_loinc.sql rename to cumulus_library_covid/covid_symptom/define_pcr.sql diff --git a/cumulus_library_covid/covid_symptom/define_pcr_negative.sql b/cumulus_library_covid/covid_symptom/define_pcr_negative.sql new file mode 100644 index 0000000..4ec1ee6 --- /dev/null +++ b/cumulus_library_covid/covid_symptom/define_pcr_negative.sql @@ -0,0 +1,24 @@ +create or replace view covid_symptom__define_pcr_negative as select * from (values +('http://snomed.info/sct', '131194007', 'Non-Reactive (qualifier value)') +,('http://snomed.info/sct', '168230009', 'Sample direct microscopy no organism seen (finding)') +,('http://snomed.info/sct', '17621005', 'Normal (qualifier value)') +,('http://snomed.info/sct', '23506009', 'Normal flora (finding)') +,('http://snomed.info/sct', '260385009', 'Negative (qualifier value)') +,('http://snomed.info/sct', '260389003', 'No reaction (qualifier value)') +,('http://snomed.info/sct', '260394003', 'Normal limits (qualifier value)') +,('http://snomed.info/sct', '260395002', 'Normal range (qualifier value)') +,('http://snomed.info/sct', '260415000', 'Not detected (qualifier value)') +,('http://snomed.info/sct', '264868006', 'No growth (qualifier value)') +,('http://snomed.info/sct', '264887000', 'Not isolated (qualifier value)') +,('http://snomed.info/sct', '2667000', 'Absent (qualifier value)') +,('http://snomed.info/sct', '272519000', 'Absence findings (qualifier value)') +,('http://snomed.info/sct', '27863008', 'No organisms seen (finding)') +,('http://snomed.info/sct', '280413001', 'Normal result (qualifier value)') +,('http://snomed.info/sct', '281297005', 'Analyte not detected (qualifier value)') +,('http://snomed.info/sct', '371928007', 'Not significant (qualifier value)') +,('http://snomed.info/sct', '373067005', 'No (qualifier value)') +,('http://snomed.info/sct', '435151000124100', 'No acid fast organisms seen (finding)') +,('http://snomed.info/sct', '444991000124106', 'Repeatedly non-reactive (qualifier value)') +,('http://snomed.info/sct', '449501000124109', 'Within defined limits (qualifier value)') +,('http://snomed.info/sct', '47492008', 'Not seen (qualifier value)') +) AS t (system, code, display) ; \ No newline at end of file diff --git a/cumulus_library_covid/covid_symptom/define_pcr_positive.sql b/cumulus_library_covid/covid_symptom/define_pcr_positive.sql new file mode 100644 index 0000000..6a1265c --- /dev/null +++ b/cumulus_library_covid/covid_symptom/define_pcr_positive.sql @@ -0,0 +1,32 @@ +create or replace view covid_symptom__define_pcr_positive as select * from (values +('http://snomed.info/sct', '10828004', 'Positive (qualifier value)') +,('http://snomed.info/sct', '11214006', 'Reactive (qualifier value)') +,('http://snomed.info/sct', '117006002', 'Weakly-reactive (qualifier value)') +,('http://snomed.info/sct', '260347006', 'Present + out of ++++ (qualifier value)') +,('http://snomed.info/sct', '260348001', 'Present ++ out of ++++ (qualifier value)') +,('http://snomed.info/sct', '260349009', 'Present +++ out of ++++ (qualifier value)') +,('http://snomed.info/sct', '260350009', 'Present ++++ out of ++++ (qualifier value)') +,('http://snomed.info/sct', '260351008', 'Just noticeable (qualifier value)') +,('http://snomed.info/sct', '260373001', 'Detected (qualifier value)') +,('http://snomed.info/sct', '260405006', 'Trace (qualifier value)') +,('http://snomed.info/sct', '260408008', 'Weakly positive (qualifier value)') +,('http://snomed.info/sct', '260411009', 'Presence findings (qualifier value)') +,('http://snomed.info/sct', '263654008', 'Abnormal (qualifier value)') +,('http://snomed.info/sct', '263776006', 'Heavy growth (qualifier value)') +,('http://snomed.info/sct', '263812008', 'Moderate growth (qualifier value)') +,('http://snomed.info/sct', '280415008', 'Abnormal result (qualifier value)') +,('http://snomed.info/sct', '373066001', 'Yes (qualifier value)') +,('http://snomed.info/sct', '410515003', 'Known present (qualifier value)') +,('http://snomed.info/sct', '410591008', 'Definitely present (qualifier value)') +,('http://snomed.info/sct', '410592001', 'Probably present (qualifier value)') +,('http://snomed.info/sct', '410605003', 'Confirmed present (qualifier value)') +,('http://snomed.info/sct', '43261007', 'Abnormal presence of (qualifier value)') +,('http://snomed.info/sct', '441517005', 'Present two plus out of three plus (qualifier value)') +,('http://snomed.info/sct', '441521003', 'Present three plus out of three plus (qualifier value)') +,('http://snomed.info/sct', '441614007', 'Present one plus out of three plus (qualifier value)') +,('http://snomed.info/sct', '46651001', 'Isolated (qualifier value)') +,('http://snomed.info/sct', '52101004', 'Present (qualifier value)') +,('http://snomed.info/sct', '61620004', 'True positive (qualifier value)') +,('http://snomed.info/sct', '7882003', 'Identified (qualifier value)') +,('http://snomed.info/sct', '89292003', 'Rare (qualifier value)') +) AS t (system, code, display) ; \ No newline at end of file diff --git a/cumulus_library_covid/covid_symptom/manifest.toml b/cumulus_library_covid/covid_symptom/manifest.toml index d261e86..825a3f9 100644 --- a/cumulus_library_covid/covid_symptom/manifest.toml +++ b/cumulus_library_covid/covid_symptom/manifest.toml @@ -2,15 +2,21 @@ study_prefix = "covid_symptom" [sql_config] file_names = [ - "define_dx_icd10.sql", - "site_define.sql", - "covid_define_symptom.sql", - "covid_define.sql", - "count_covid_study_period.sql", - "count_covid_dx.sql", - "count_covid_pcr.sql", - "count_covid_symptom.sql", - "count_covid_prevalence_ed.sql", + "define_age_pediatric.sql", +# "define_age_general.sql", # Hospitals that are pediatric should use this instead ! +# "define_study_period.sql", + "define_pcr.sql", + "define_pcr_positive.sql", + "define_pcr_negative.sql", +# "define_dx_icd10.sql", +# "site_define.sql", +# "covid_define_symptom.sql", +# "covid_define.sql", +# "count_covid_study_period.sql", +# "count_covid_dx.sql", +# "count_covid_pcr.sql", +# "count_covid_symptom.sql", +# "count_covid_prevalence_ed.sql", ]