-
Notifications
You must be signed in to change notification settings - Fork 13
Expose BookedDate and StartDate #885
Description
We need to make Appointment.BookedDate and Appointment.StartDate available through patients.with_gp_consultations for an upcoming study that @LisaHopcroft is coordinating.
At present, only Appointment.SeenDate is made available through this function, so we need to add a new argument that allows a user to select the column they wish to query. Precedents:
- Several functions, such as
patients.address_as_of, accept areturningargument that allows a user to select a column. patients.with_these_decision_support_valuesaccepts analgorithmargument, which allows the user to select an algorithm (spoiler: only the Electronic Frailty Index is available).
Lisa and I have undertaken some curation work on these columns; a notebook has been released to the appointments-short-data-report workspace. However, I see that we restrict the values in the status column to these
cohort-extractor/cohortextractor/tpp_backend.py
Lines 2105 to 2113 in faca1e5
| valid_states = [ | |
| AppointmentStatus.ARRIVED, | |
| AppointmentStatus.WAITING, | |
| AppointmentStatus.IN_PROGRESS, | |
| AppointmentStatus.FINISHED, | |
| AppointmentStatus.PATIENT_WALKED_OUT, | |
| AppointmentStatus.VISIT, | |
| ] | |
| valid_states_str = codelist_to_sql(map(int, valid_states)) |
from these
cohort-extractor/cohortextractor/tpp_backend.py
Lines 3813 to 3828 in faca1e5
| class AppointmentStatus(enum.IntEnum): | |
| BOOKED = 0 | |
| ARRIVED = 1 | |
| DID_NOT_ATTEND = 2 | |
| IN_PROGRESS = 3 | |
| FINISHED = 4 | |
| REQUESTED = 5 | |
| BLOCKED = 6 | |
| VISIT = 8 | |
| WAITING = 9 | |
| CANCELLED_BY_PATIENT = 10 | |
| CANCELLED_BY_UNIT = 11 | |
| CANCELLED_BY_OTHER_SERVICE = 12 | |
| NO_ACCESS_VISIT = 14 | |
| CANCELLED_DUE_TO_DEATH = 15 | |
| PATIENT_WALKED_OUT = 16 |
in cohort-extractor. Our curation work hasn't explored the status column, so I'd tentatively advocate allowing a user to disable this restriction.