19.1.34. camcops_server.cc_modules.cc_report


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_report.Report[source]

Abstract base class representing a report.

Must override attributes:

report_id
String used in HTML selector
report_title
String for display purposes
get_rows_descriptions
returns the actual data; the request data will have been pre- validated against the report’s form
get_schema_class
Schema used to create a form for seeking parameters; override this for simple parameter collection (if you just override this, you’ll get a ReportParamForm with this schema).
get_form
Schema used to create a form for seeking parameters; override this for full control over parameter collection.
classmethod all_subclasses(sort_title: bool = False) → List[Type[Report]][source]

Get all report subclasses, except those not implementing their report_id property.

get_query(req: CamcopsRequest) → Union[NoneType, sqlalchemy.sql.selectable.SelectBase, sqlalchemy.orm.query.Query][source]

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

static get_test_querydict() → Dict[str, Any][source]

What this function returns is used as the specimen appstruct for unit tests.

render_html(req: CamcopsRequest, column_names: List[str], page: camcops_server.cc_modules.cc_pyramid.CamcopsPage) → pyramid.response.Response[source]

If you wish, you can override this for more report customization.

class camcops_server.cc_modules.cc_report.ReportTests(methodName='runTest')[source]
camcops_server.cc_modules.cc_report.get_all_report_ids() → List[str][source]

Get all report IDs.

Report IDs are fixed names defined in each Report subclass.

camcops_server.cc_modules.cc_report.get_report_instance(report_id: str) → Union[camcops_server.cc_modules.cc_report.Report, NoneType][source]

Creates an instance of a Report, given its ID (name), or None.