13.2.61. camcops_server.cc_modules.cc_simpleobjects

camcops_server/cc_modules/cc_simpleobjects.py


Copyright (C) 2012-2019 Rudolf Cardinal (rudolf@pobox.com).

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 <http://www.gnu.org/licenses/>.


Simple struct-like classes.

class camcops_server.cc_modules.cc_simpleobjects.BarePatientInfo(forename: str = None, surname: str = None, sex: str = None, dob: pendulum.date.Date = None, address: str = None, gp: str = None, other: str = None, idnum_definitions: 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).

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(id: 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 and idnum_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 as IdNumReference(which_idnum=7, idnum_value=9999999999).

class camcops_server.cc_modules.cc_simpleobjects.TaskExportOptions(db_patient_id_in_each_row: 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: 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.

Parameters:
  • db_patient_id_in_each_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://dx.doi.org/10.1186%2Fs12911-017-0437-1).
  • 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.

class camcops_server.cc_modules.cc_simpleobjects.XmlSimpleValue(value)[source]

Represents XML lowest-level items. See functions in cc_xml.py.