15.2.148. camcops_server.cc_modules.cc_simpleobjects¶
camcops_server/cc_modules/cc_simpleobjects.py
Copyright (C) 2012, University of Cambridge, Department of Psychiatry. Created by Rudolf Cardinal (rnc1001@cam.ac.uk).
This file is part of CamCOPS.
CamCOPS 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.
CamCOPS 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 CamCOPS. If not, see <https://www.gnu.org/licenses/>.
Simple struct-like classes.
- class camcops_server.cc_modules.cc_simpleobjects.BarePatientInfo(forename: Optional[str] = None, surname: Optional[str] = None, sex: Optional[str] = None, dob: Optional[pendulum.date.Date] = None, address: Optional[str] = None, email: Optional[str] = None, gp: Optional[str] = None, otherdetails: Optional[str] = None, idnum_definitions: Optional[List[camcops_server.cc_modules.cc_simpleobjects.IdNumReference]] = None)[source]¶
Represents information about a patient using a simple object with no connection to a database.
In some situations we avoid using
camcops_server.cc_modules.cc_patient.Patient
: specifically, when we would otherwise have to deal with mutual dependency problems and the use of the database (prior to full database initialization).- __init__(forename: Optional[str] = None, surname: Optional[str] = None, sex: Optional[str] = None, dob: Optional[pendulum.date.Date] = None, address: Optional[str] = None, email: Optional[str] = None, gp: Optional[str] = None, otherdetails: Optional[str] = None, idnum_definitions: Optional[List[camcops_server.cc_modules.cc_simpleobjects.IdNumReference]] = None) None [source]¶
- add_idnum(idref: camcops_server.cc_modules.cc_simpleobjects.IdNumReference) None [source]¶
Adds an ID number. No checks in relation to what’s already present.
- Parameters
idref – a
IdNumReference
- class camcops_server.cc_modules.cc_simpleobjects.HL7PatientIdentifier(pid: str, id_type: str, assigning_authority: str)[source]¶
Represents a patient identifier for the HL7 protocol.
- class camcops_server.cc_modules.cc_simpleobjects.IdNumReference(which_idnum: int, idnum_value: int)[source]¶
A simple way of referring to an ID number.
It’s not stored in the database – it’s just an object to be passed around that encapsulates
which_idnum
andidnum_value
.As an example, suppose our administrator has defined ID type (
which_idnum
) 7 to be “NHS number”. Then if a patient has NHS number 9999999999, we might represent this ID of theirs asIdNumReference(which_idnum=7, idnum_value=9999999999)
.
- class camcops_server.cc_modules.cc_simpleobjects.TaskExportOptions(db_patient_id_per_row: bool = False, db_make_all_tables_even_empty: bool = False, db_include_summaries: bool = False, include_blobs: bool = False, xml_include_ancillary: bool = False, xml_include_calculated: bool = False, xml_include_comments: bool = True, xml_include_patient: bool = False, xml_include_plain_columns: bool = False, xml_include_snomed: bool = False, xml_skip_fields: Optional[List[str]] = None, xml_sort_by_name: bool = True, xml_with_header_comments: bool = False)[source]¶
Information-holding object for options controlling XML and other representations of tasks.
- __init__(db_patient_id_per_row: bool = False, db_make_all_tables_even_empty: bool = False, db_include_summaries: bool = False, include_blobs: bool = False, xml_include_ancillary: bool = False, xml_include_calculated: bool = False, xml_include_comments: bool = True, xml_include_patient: bool = False, xml_include_plain_columns: bool = False, xml_include_snomed: bool = False, xml_skip_fields: Optional[List[str]] = None, xml_sort_by_name: bool = True, xml_with_header_comments: bool = False) None [source]¶
- Parameters
db_patient_id_per_row – generates an anonymisation staging database – that is, a database with patient IDs in every row of every table, suitable for feeding into an anonymisation system like CRATE (https://doi.org/10.1186%2Fs12911-017-0437-1).
db_make_all_tables_even_empty – create all tables, even empty ones
include_blobs – include binary large objects (BLOBs) (applies to several export formats)
xml_include_ancillary – include ancillary tables as well as the main?
xml_include_calculated – include fields calculated by the task
xml_include_comments – include comments in XML?
xml_include_patient – include patient details?
xml_include_plain_columns – include the base columns
xml_include_snomed – include SNOMED-CT codes, if available?
xml_skip_fields – fieldnames to skip
xml_sort_by_name – sort by field/attribute names?
xml_with_header_comments – include header-style comments?
- clone() camcops_server.cc_modules.cc_simpleobjects.TaskExportOptions [source]¶
Returns a copy of this object.