15.2.169. camcops_server.cc_modules.cc_tracker

camcops_server/cc_modules/cc_tracker.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/>.


Trackers, showing numerical information over time, and clinical text views, showing text that a clinician might care about.

class camcops_server.cc_modules.cc_tracker.ClinicalTextView(req: CamcopsRequest, taskfilter: camcops_server.cc_modules.cc_taskfilter.TaskFilter, via_index: bool = True)[source]

Class representing a clinical text view.

__init__(req: CamcopsRequest, taskfilter: camcops_server.cc_modules.cc_taskfilter.TaskFilter, via_index: bool = True) None[source]

Initialize, fetching applicable tasks.

get_xml(indent_spaces: int = 4, eol: str = '\n', include_comments: bool = False) str[source]

Returns an XML representation.

Parameters
  • indent_spaces – number of spaces to indent formatted XML

  • eol – end-of-line string

  • include_comments – include comments describing each field?

Returns

an XML UTF-8 document representing our object.

class camcops_server.cc_modules.cc_tracker.ConsistencyInfo(req: CamcopsRequest, tasklist: List[camcops_server.cc_modules.cc_task.Task])[source]

Represents ID consistency information about a set of tasks.

__init__(req: CamcopsRequest, tasklist: List[camcops_server.cc_modules.cc_task.Task]) None[source]

Initialize values, from a list of task instances.

are_all_consistent() bool[source]

Is all the ID information consistent?

get_description_list() List[str][source]

Textual representation of ID information, indicating consistency or lack of it.

get_xml_root() camcops_server.cc_modules.cc_xml.XmlElement[source]

XML tree (as root camcops_server.cc_modules.cc_xml.XmlElement) of consistency information.

class camcops_server.cc_modules.cc_tracker.Tracker(req: CamcopsRequest, taskfilter: camcops_server.cc_modules.cc_taskfilter.TaskFilter, via_index: bool = True)[source]

Class representing a numerical tracker.

__init__(req: CamcopsRequest, taskfilter: camcops_server.cc_modules.cc_taskfilter.TaskFilter, via_index: bool = True) None[source]

Initialize, fetching applicable tasks.

get_all_plots_for_one_task_html(tasks: List[camcops_server.cc_modules.cc_task.Task]) str[source]

HTML for all plots for a given task type.

get_single_plot_html(datetimes: List[pendulum.datetime.DateTime], values: List[Optional[float]], specimen_tracker: TrackerInfo) str[source]

HTML for a single figure.

get_xml(indent_spaces: int = 4, eol: str = '\n', include_comments: bool = False) str[source]

Returns an XML representation.

Parameters
  • indent_spaces – number of spaces to indent formatted XML

  • eol – end-of-line string

  • include_comments – include comments describing each field?

Returns

an XML UTF-8 document representing our object.

class camcops_server.cc_modules.cc_tracker.TrackerCtvCommon(req: CamcopsRequest, taskfilter: camcops_server.cc_modules.cc_taskfilter.TaskFilter, as_ctv: bool, via_index: bool = True)[source]

Base class for camcops_server.cc_modules.cc_tracker.Tracker and camcops_server.cc_modules.cc_tracker.ClinicalTextView.

__init__(req: CamcopsRequest, taskfilter: camcops_server.cc_modules.cc_taskfilter.TaskFilter, as_ctv: bool, via_index: bool = True) None[source]

Initialize, fetching applicable tasks.

get_html() str[source]

Get HTML representing this object.

get_pdf() bytes[source]

Get PDF representing tracker/CTV.

get_pdf_html() str[source]

Returns HTML to be made into a PDF representing this object.

get_xml(indent_spaces: int = 4, eol: str = '\n', include_comments: bool = False) str[source]

Returns an XML representation.

Parameters
  • indent_spaces – number of spaces to indent formatted XML

  • eol – end-of-line string

  • include_comments – include comments describing each field?

Returns

an XML UTF-8 document representing our object.

suggested_pdf_filename() str[source]

Get suggested filename for tracker/CTV PDF.

camcops_server.cc_modules.cc_tracker.consistency(req: CamcopsRequest, values: List[Any], servervalue: Any = None, case_sensitive: bool = True) Tuple[bool, str][source]

Checks for consistency in a set of values (e.g. names, dates of birth). (ID numbers are done separately via consistency_idnums().)

The list of values (with the servervalue appended, if not None) is checked to ensure that it contains only one unique value (ignoring None values or empty "" values).

Returns

the tuple consistent, msg, where consistent is a bool and msg is a descriptive HTML message

camcops_server.cc_modules.cc_tracker.consistency_idnums(req: CamcopsRequest, idnum_lists: List[List[PatientIdNum]]) Tuple[bool, str][source]

Checks the consistency of a set of PatientIdNum objects. “Are all these records from the same patient?”

Parameters
Returns

the tuple consistent, msg, where consistent is a bool and msg is a descriptive HTML message

camcops_server.cc_modules.cc_tracker.format_daterange(start: Optional[pendulum.datetime.DateTime], end: Optional[pendulum.datetime.DateTime]) str[source]

Textual representation of an inclusive-to-exclusive date range.

Arguments are datetime values.