19.1.27. camcops_server.cc_modules.cc_patient


Copyright (C) 2012-2018 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/>.


class camcops_server.cc_modules.cc_patient.DistinctPatientReport[source]

Report to show distinct patients.

get_query(req: camcops_server.cc_modules.cc_request.CamcopsRequest) → sqlalchemy.sql.selectable.SelectBase[source]

Return the Select statement to execute the report. Must override. Parameters are passed in via the Request.

class camcops_server.cc_modules.cc_patient.Patient(**kwargs)[source]

Class representing a patient.

apply_special_note(req: camcops_server.cc_modules.cc_request.CamcopsRequest, note: str, audit_msg: str = 'Special note applied manually') → None[source]

Manually applies a special note to a patient. WRITES TO DATABASE.

audit(req: camcops_server.cc_modules.cc_request.CamcopsRequest, details: str, from_console: bool = False) → None[source]

Audits actions to this patient.

get_address() → Union[str, NoneType][source]

Returns address (NOT necessarily web-safe).

get_age(req: camcops_server.cc_modules.cc_request.CamcopsRequest, default: str = '') → Union[int, str][source]

Age (in whole years) today, or default.

get_age_at(when: Union[NoneType, datetime.date, str, arrow.arrow.Arrow], default: str = '') → Union[int, str][source]

Age (in whole years) at a particular date, or default.

get_bare_ptinfo() → camcops_server.cc_modules.cc_simpleobjects.BarePatientInfo[source]

Get basic identifying information, as a BarePatientInfo.

get_dob() → Union[pendulum.date.Date, NoneType][source]

Date of birth, as a a timezone-naive date.

get_dob_html(longform: bool) → str[source]

HTML fragment for date of birth.

get_forename() → str[source]

Get forename (in upper case) or “”.

get_hl7_pid_segment(req: camcops_server.cc_modules.cc_request.CamcopsRequest, recipient_def: camcops_server.cc_modules.cc_recipdef.RecipientDefinition) → hl7.containers.Segment[source]

Get HL7 patient identifier (PID) segment.

get_iddesc(req: camcops_server.cc_modules.cc_request.CamcopsRequest, which_idnum: int) → Union[str, NoneType][source]

Get value of a specific ID description, if present.

get_idnum_object(which_idnum: int) → Union[camcops_server.cc_modules.cc_patientidnum.PatientIdNum, NoneType][source]

Gets the PatientIdNum object for a specified which_idnum, or None.

get_idnum_value(which_idnum: int) → Union[int, NoneType][source]

Get value of a specific ID number, if present.

get_idshortdesc(req: camcops_server.cc_modules.cc_request.CamcopsRequest, which_idnum: int) → Union[str, NoneType][source]

Get value of a specific ID short description, if present.

get_sex() → str[source]

Return sex or “”.

get_sex_verbose(default: str = 'sex unknown') → str[source]

Returns HTML-safe version of sex, or default.

get_surname() → str[source]

Get surname (in upper case) or “”.

get_surname_forename_upper() → str[source]

Get “SURNAME, FORENAME” in HTML-safe format, using “UNKNOWN” for missing details.

get_xml_root(req: camcops_server.cc_modules.cc_request.CamcopsRequest, skip_fields: List[str] = None) → camcops_server.cc_modules.cc_xml.XmlElement[source]

Get root of XML tree, as an XmlElementTuple.

is_female() → bool[source]

Is sex ‘F’?

is_male() → bool[source]

Is sex ‘M’?

is_preserved() → bool[source]

Is the patient record preserved and erased from the tablet?

satisfies_finalize_id_policy() → bool[source]

Does the patient satisfy the finalizing ID policy?

satisfies_id_policy(policy: camcops_server.cc_modules.cc_policy.TokenizedPolicy) → bool[source]

Does the patient satisfy a particular ID policy?

satisfies_upload_id_policy() → bool[source]

Does the patient satisfy the uploading ID policy?

class camcops_server.cc_modules.cc_patient.PatientTests(methodName='runTest')[source]