Conversation
920b741 to
3d8451d
Compare
|
Note this comment There are rows that have the same visit ID for more than one patient. Where that happens, it tends to happen several times for same 2 patients across multiple different visits, which seems like it is valid, not just a data entry error. Possibly a form can be completed once for a household, not just for a single patient - waiting for confirmation from TPP |
iaindillingham
left a comment
There was a problem hiding this comment.
A couple of typo suggestions, but that's all. Really clear to read and reason about 🙂
tests/test_tpp_backend.py
Outdated
| ), | ||
| # Coded categories are converted to long-form string labels | ||
| # result_tdi is a coded category value; varchar type in the db | ||
| # raw values are stringified ints, return the long form category lable |
There was a problem hiding this comment.
| # raw values are stringified ints, return the long form category lable | |
| # raw values are stringified ints, return the long form category label |
tests/test_tpp_backend.py
Outdated
| date_format="YYYY-MM-DD", | ||
| ), | ||
| # country is a coded category value, int type in the db | ||
| # raw values are ints, return the long form category lable |
There was a problem hiding this comment.
| # raw values are ints, return the long form category lable | |
| # raw values are ints, return the long form category label |
tests/test_tpp_backend.py
Outdated
| Patient( | ||
| ONS_CIS=[ | ||
| ONS_CIS( | ||
| age_at_visit="20", |
There was a problem hiding this comment.
Is this a string for testing some aspect of the method? We use ints elsewhere.
| age_at_visit="20", | |
| age_at_visit=20, |
There was a problem hiding this comment.
No, it's an int in the raw table, will update it
| country=2, | ||
| self_isolating=0, | ||
| ), | ||
| # duplicate record ignored in number_of_matches_in_period counts |
There was a problem hiding this comment.
Thanks for commenting here. It saved me a lot of head-scratching 🙂
| age_at_visit=[20, 30, 41], | ||
| age_at_visit_date=["2021-10-01", "2021-10-01", "2021-10-01"], |
There was a problem hiding this comment.
Thanks for returning the dates here (and elsewhere). It made associating the fixtures with the results much easier. It's also a helpful reminder that visit_date is the default date column.
|
Thanks @iaindillingham - I'm having some second thoughts on whether it's sensible to determine the |
Fixes #587
Adds
patients_with_an_ons_cis_recordmethod to the TPP backend.Similar to ISARIC, this method allows returning any column from the dataset. There are multiple rows per patient (more or less unique by visit_id and visit_date), but as there are multiple date columns, we also have a
date_filter_columnthat can be specified.Many of the columns are coded - e.g. sex takes values of 1 or 2, where 1=male and 2=female. The keys are numeric, and mostly these columns are integer type, although a few are varchar. (but still numbers, stringified). Unless explicitly requested, we turn these codes into their string labels in the returned data. If the original codes are requested (with
return_category_labels=False), we have to cast them to varchar, otherwise any integer-type values will return 0 when there's no data, which is often a valid code itself.See also corresponding PRS:
restrict use of ONS_CIS dataset: opensafely-core/opensafely-cli#111
docs: opensafely/documentation#677