renalreg / ukrr_models

SQL Alchemy models for the UKRR Database. Also exports to RDA.
MIT License
0 stars 0 forks source link

initial commit #3

Closed philmain28 closed 1 year ago

philmain28 commented 1 year ago

@George-D-S

I have plumbed in the three functions from simplified extract. Basically the main thing to do now is expand the list of QUA items. I started doing this but I'm not sure exactly what should be included. Is it basically all the field names in the quarterly treatment table? If so how are they categorized Observations vs LabOrders? I'm assuming something like statin drug use isn't a lab order but is it an observation?

George-D-S commented 1 year ago

I'm not sure it's recorded electronically anywhere (yet?) but if you look in a copy of the V5 dataset then the Observations and Results are split into different tabs in the workbook.

philmain28 commented 1 year ago

So I have found the v5 data set here: R:\0 Informatics\RR Dataset Specification\05 Dataset v5.0\DataSet_v5_0_For Renal units. It seems that there are no QUA codes? either in observations or lab orders.

This line onwards only runs if there are no laborders. https://github.com/renalreg/ukrr_models/blob/c48f3661add9bc44091ac2fe9caf727c2d1143f0/ukrr_models/rr_models.py#L377

What's the deal with this it the chunk of code with the QUA depricated in v5?

George-D-S commented 1 year ago

This is a mistake - it should be like follows. Although we don't ask for QBL in V5 (and indeed V4) some sites are only sending in QUA blocks. I did wonder if I had intended to only output QUA blocks if QBL ones didn't exist, however we only have older data in QUA format so I think it's more correct to do both.

      if len(results) > 0:
            if not laborders_node:
                self.xml_patient_record.LabOrders = pyxb.BIND()
                laborders_node = True

            for row in results: