14.3.24. crate_anon.crateweb.consent.lookup_systmone
crate_anon/crateweb/consent/lookup_systmone.py
Copyright (C) 2015, University of Cambridge, Department of Psychiatry. Created by Rudolf Cardinal (rnc1001@cam.ac.uk).
This file is part of CRATE.
CRATE is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
CRATE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with CRATE. If not, see <https://www.gnu.org/licenses/>.
Functions to look up patient details from a TPP SystmOne Strategic Reporting Extract (SRE) database, or at least its CPFT equivalent.
- class crate_anon.crateweb.consent.lookup_systmone.ResearchSNOMED[source]
SNOMED codes used for the CPFT Research Database in SystmOne.
Verify at https://termbrowser.nhs.uk/.
- crate_anon.crateweb.consent.lookup_systmone.gen_opt_out_pids_mpids_cpft_systmone() Generator[Tuple[str, str], None, None] [source]
Generates PID/MPID pairs from all patients opting out entirely from the CPFT Research Database, from a CPFT SystmOne database.
Note: this is the CPFT Research Database opt-out, not the NHS National Data Opt-Out. The latter applies to NHS Act s251 work, and is in SRNDOptOutPreference [marked as “future” in the SRE details?] or, in CPFT’s copy, S1_Patient.NationalDataOptOut.
- Yields:
s1_patient_id, nhs_number
for each patient opting out, in string format
PRESUMPTION: that if some “un-opts out”, their row here is deleted. There is a DateEvent column, but no codes for reversing the decision.
SELECT DISTINCT SNOMEDCode, SNOMEDText, CTV3Code, CTV3Text FROM S1_ClinicalOutcome_ConsentResearch_OptOutCheck
- crate_anon.crateweb.consent.lookup_systmone.get_latest_consent_mode_from_cpft_systmone(nhs_number: int, decisions: List[str]) ConsentMode | None [source]
Returns the latest CPFT consent mode for a patient, from a CPFT SystmOne database.
- Parameters:
nhs_number – NHS number
decisions – list of human-readable decisions; will be modified
- Returns:
- crate_anon.crateweb.consent.lookup_systmone.lookup_cpft_systmone(lookup: PatientLookup, decisions: List[str], secret_decisions: List[str]) None [source]
Look up patient details from a TPP SystmOne Strategic Reporting Extract (SRE) database.
- Parameters:
decisions – list of human-readable decisions; will be modified
secret_decisions – list of human-readable decisions containing secret (identifiable) information; will be modified