15.2.157. camcops_server.cc_modules.cc_summaryelement

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


Classes to represent summary information created by tasks.

For example, the PHQ9 task calculates a total score; that’s part of its summary information.

class camcops_server.cc_modules.cc_summaryelement.ExtraSummaryTable(tablename: str, xmlname: str, columns: List[sqlalchemy.sql.schema.Column], rows: List[Union[Dict[str, Any], collections.OrderedDict]], task: Task)[source]

Additional summary information returned by a task.

Use this to represent an entire table that doesn’t have a 1:1 relationship with rows of a task or ancillary object.

__init__(tablename: str, xmlname: str, columns: List[sqlalchemy.sql.schema.Column], rows: List[Union[Dict[str, Any], collections.OrderedDict]], task: Task) None[source]
Parameters
  • tablename – name of the additional summary table

  • xmlname – name of the XML tag to encapsulate this information

  • columns – list of SQLAlchemy columns

  • rows – list of rows, where each row is a dictionary mapping column names to values

  • task – parent task (for cross-referencing in some kinds of export)

get_spreadsheet_page() camcops_server.cc_modules.cc_spreadsheet.SpreadsheetPage[source]

Returns an camcops_server.cc_modules.cc_spreadsheet.SpreadsheetPage representing this summary table.

get_spreadsheet_schema_elements() Set[camcops_server.cc_modules.cc_dataclasses.SummarySchemaInfo][source]

Schema equivalent to get_spreadsheet_page().

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

Returns an camcops_server.cc_modules.cc_xml.XmlElement representing this summary table.

task_ancestor() Optional[Task][source]

Returns the specific ancestor task of this object.

class camcops_server.cc_modules.cc_summaryelement.SummaryElement(name: str, coltype: sqlalchemy.sql.type_api.TypeEngine, value: Any, comment: Optional[str] = None)[source]

Returned by tasks to represent extra summary information that they calculate.

Use this for extra information that can be added to a row represented by a task or its ancillary object.

__init__(name: str, coltype: sqlalchemy.sql.type_api.TypeEngine, value: Any, comment: Optional[str] = None) None[source]
Parameters
  • name – column name

  • coltype – SQLAlchemy column type; e.g. Integer(), String(length=50)

  • value – value

  • comment – explanatory comment