opensafely-core / cohort-extractor

Cohort extractor tool which can generate dummy data, or real data against OpenSAFELY-compliant research databases
Other
38 stars 13 forks source link

filter SGSS testing data by pillar #248

Open wjchulme opened 4 years ago

wjchulme commented 4 years ago

Something like

    pos_pillar2_test = patients.with_test_result_in_sgss(
    pathogen="SARS-CoV-2",
    test_result="positive",
    pillar=2,
    returning="date",
    date_format="YYYY-MM-DD"
)

Currently the pillar column (=Lab_Type) takes values PILLAR 2 TESTING or OTHER. Not sure whether this will change in future (eg to include serology / antibody testing from pillar 3)

HelenCEBM commented 3 years ago

Any updates on this?

sebbacon commented 3 years ago

Should this be labelled "prioritisation candidate"?

wjchulme commented 3 years ago

should this be labelled "prioritisation candidate".

if possible, yes. This would make #563 much more useful.

Since this issue was created, we now also have the pillar and lab type variables in the SGSS_AllTests_Positive and SGSS_AllTests_Negative tables, so we in theory have pillar info for all tests. I think pillar is a variable created by TPP based on lab_type, but need to double-check.

wjchulme commented 3 years ago

Just had a look. The distinct values for Lab_Type and Pillar are as follows:

Lab_Type in SGSS_AllTests_Positive: ["OTHER", "PILLAR 2 TESTING"] Lab_Type in SGSS_AllTests_Negative: ["OTHER"]

Pillar in SGSS_AllTests_Positive: [NULL] Pillar in SGSS_AllTests_Negative: ["Pillar 1", "Pillar 2"]

If we assume "OTHER" is only pillar 1, then we can use Lab_Type from SGSS_AllTests_Positive and Pillar from SGSS_AllTests_Negative to determine pillar across all tests. Need to check this is a safe assumption!

wjchulme commented 3 years ago

Chris + Jonny both on holiday so will check when they get back