ideafast / middleware-services

Python API containing endpoints for smartphone hub applications and transfer to data portal
0 stars 0 forks source link

Invoke pre-processing if file has been downloaded #65

Closed jawrainey closed 3 years ago

jawrainey commented 3 years ago

As noted in #62, I have identified a bug in the pipeline where is_downloaded in a record is not set the True, yet all the subsequent stages (pre-processing, prepare, and upload) are invokved. This is because the pre-processing stage does not check if a record is_downloaded and so it is to to True as are all subsequent stages.

64 adds measures in place to raise an error if such an error occurs, whilst this PR addresses the known bug.

Testing

  1. Modify __group_by_composite_key in /db/main.py by adding an IF statement for the one known user who where this bug was discovered:
if _record.patient_id in ["USER_ID"]:
    key = f"{_record.patient_id}/{_record.device_id}"
    results[key].append(_record)
  1. Run the DRM pipeline and note that the error no long exists.

Ideally do both steps on master and then on this branch to see the change in action. Note that when on master the patient's records (1/2 dreem files) will be uploaded to DMP whereas when on this branch none will be uploaded and all subsequent stages will be false.