ouhft / COPE

Project Repository for Work Package 4 of the COPE Transplant Trial
https://cope.nds.ox.ac.uk
1 stars 0 forks source link

[DMC Updates] Set inclusion / exclusion for analysis #318

Closed marshalc closed 5 years ago

marshalc commented 6 years ago

Based on the following rules, set an automated value of included/excluded for analysis.

Potential reasons for exclusion after randomisation are:

Where an exclusion criteria is triggered, set a note in a new field to make the reason clearer and easier to output quickly in a query.

marshalc commented 6 years ago

Initial analysis suggests we're getting too many exclusions because of dodgy data. Most suspect value seems to be the Donor not proceeding value in donor.not_randomised_because. I don't have time to speculate or investigate the cause though, let alone do the data cleanup at this moment.

marshalc commented 6 years ago

Data cleanup needed, so need to apply this to the production data:

/* Data cleanup - donor.not_randomised_because has many non-zero values on randomised donors, which is illogical */
UPDATE compare_donor
SET not_randomised_because = 0
WHERE id IN (SELECT donor_id FROM compare_randomisation WHERE donor_id NOT NULL);
marshalc commented 6 years ago

Test function can be called from python command line with:

from wp4.compare.models.donor import Organ
for organ in Organ.objects.all():
    organ.update_inclusion_status()
marshalc commented 6 years ago

More irrelevant data - 9 cases of an automated "Allocated to non-Project Site" being set in Organ.not_allocated_because, which are then proven false by later updates to valid project sites.

SELECT
  o.id, o.trial_id, h.name, o.not_allocated_reason
FROM compare_organ as o,
  compare_recipient as r,
  compare_organallocation as a,
  locations_hospital as h
WHERE o.id = r.organ_id
  AND r.allocation_id = a.id
  AND a.transplant_hospital_id = h.id
  AND h.is_project_site = 1
  AND o.not_allocated_reason > “"

... will show them.

Not yet clear whether I should remove this data at this stage, or leave it to be ignored. It is (however) causing errors in the rules function as a result.

marshalc commented 5 years ago

No feedback on if this has been used over the past year. Marking as closed for now.