14.2.80. camcops_server.cc_modules.cc_tracker

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


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.

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(tasklist: List[camcops_server.cc_modules.cc_task.Task])[source]

Represents ID consistency information about a set of tasks.

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.

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[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.

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.

class camcops_server.cc_modules.cc_tracker.TrackerCtvTests(methodName='runTest')[source]

Unit tests.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

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

Checks for consistency in a set of values (e.g. ID numbers, names).

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(idnum_lists: List[List[_ForwardRef('PatientIdNum')]]) → Tuple[bool, str][source]

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

Parameters:idnum_lists – a list of lists (one per camcops_server.cc_modules.cc_patient.Patient instance) of PatientIdNum objects
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: Union[pendulum.datetime.DateTime, NoneType], end: Union[pendulum.datetime.DateTime, NoneType]) → str[source]

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

Arguments are datetime values.