14.3.128. crate_anon.crateweb.research.archive_func
crate_anon/crateweb/research/archive_func.py
Copyright (C) 2015, University of Cambridge, Department of Psychiatry. Created by Rudolf Cardinal (rnc1001@cam.ac.uk).
This file is part of CRATE.
CRATE 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.
CRATE 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 CRATE. If not, see <https://www.gnu.org/licenses/>.
Assistance functions for archive Mako templates.
- crate_anon.crateweb.research.archive_func.delimit_sql_identifier(identifer: str) str [source]
Delimits (quotes) an SQL identifier, if required.
- crate_anon.crateweb.research.archive_func.embedded_attachment_html(filename: str, context: Dict[str, Any], object_class: str = 'embedded_attachment', alt_div_class: str = 'obscure_spinner') str [source]
HTML element to show an attachment (such as a PDF) inline.
- Parameters:
filename – filename of attachment
context – Mako context
object_class – CSS class of the <object>
alt_div_class – CSS class of the <div> to show on load failure
- crate_anon.crateweb.research.archive_func.json_compact(x: Any) str [source]
Returns a compact JSON version of the object.
- crate_anon.crateweb.research.archive_func.nlp_source_url(row: List[Any]) str [source]
Returns a URL to the source text for some NLP, ON THE ASSUMPTION that the last columns of a query are
SILENT_NLP_XREF_COLS
.- Parameters:
row – result row
- crate_anon.crateweb.research.archive_func.patient_template_html(template_name: str, context: Dict[str, Any], iframe_class: str = 'embedded_attachment', **qparams) str [source]
HTML element to show aonther archive patient template inline.
- Parameters:
template_name – relative filename of the template
context – Mako context
iframe_class – CSS class for the <iframe>
qparams – query parameters to pass to the template
- crate_anon.crateweb.research.archive_func.template_html(template_name: str, iframe_class: str = 'embedded_attachment', **qparams) str [source]
HTML element to show aonther archive template inline (not necessarily for a specific patient).
- Parameters:
template_name – relative filename of the template
iframe_class – CSS class for the <iframe>
qparams – query parameters to pass to the template