14.2.103. camcops_server.cc_modules.cc_summaryelement


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

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[typing.Dict[str, typing.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.

  • 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_tsv_page() → camcops_server.cc_modules.cc_tsv.TsvPage[source]

Returns an camcops_server.cc_modules.cc_tsv.TsvPage representing this summary table.

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() → Union[_ForwardRef('Task'), NoneType][source]

Returns the specific ancestor task of this object.

classmethod task_ancestor_class() → Union[typing.Type[_ForwardRef('Task')], NoneType][source]

Returns the class of the ancestral task.

If the descendant can descend from lots of types of task (rare; only applies to camcops_server.cc_modules.cc_blob.Blob and camcops_server.cc_modules.cc_summaryelement.ExtraSummaryTable), returns None.

class camcops_server.cc_modules.cc_summaryelement.SummaryElement(name: str, coltype: sqlalchemy.sql.type_api.TypeEngine, value: Any, comment: 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.

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