Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8548eb8d9e | |||
| 1a1ea5c7a9 |
@@ -115,6 +115,13 @@ def last_screening_cytology(events: pd.DataFrame) -> pd.Series:
|
||||
key = ["person_id", "source_table", "source_id"]
|
||||
samples = events.loc[(events["type"] == "cytology") & ~events["person_id"].isin(referred),
|
||||
[*key, "date"]] # fmt: skip
|
||||
hysterectomy = events.loc[
|
||||
(events["source_table"] == "cervical_cytology")
|
||||
& (events["type"] == "gynecologic_condition")
|
||||
& (events["value_code"] == "hysterectomy")
|
||||
].groupby("person_id")["date"].min()
|
||||
recorded = samples["person_id"].map(hysterectomy)
|
||||
samples = samples[recorded.isna() | (samples["date"] < recorded)]
|
||||
results = events[events["type"].isin(RESULTS) & events["value_code"].notna()]
|
||||
has = results.pivot_table(index=key, columns="type", values="value_code", aggfunc="first")
|
||||
has = has.reindex(columns=list(RESULTS))
|
||||
|
||||
@@ -32,7 +32,7 @@ FIELDS = {
|
||||
"ados2": ("evaluation_date", "module", *ADOS2_SCORES),
|
||||
"eeg": ("study_date", "lab_record_id", "edf"),
|
||||
} # fmt: skip
|
||||
BOOLS = {"hpv", "hpv_16", "hpv_18"}
|
||||
BOOLS = {f for s in catalog.studies().values() for f, d in s.fields.items() if d.type == "boolean"}
|
||||
NUMBERS = {"ki67_pct", "size_mm", "positive_nodes", "score", *ADOS2_SCORES}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user