15.3.43. crate_anon.crateweb.research.views


Copyright (C) 2015-2018 Rudolf Cardinal (rudolf@pobox.com).

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 <http://www.gnu.org/licenses/>.


crate_anon.crateweb.research.views.all_text_from_pid(request: django.http.request.HttpRequest) → django.http.response.HttpResponse[source]

Picks a database, then redirects to all_text_from_pid_with_db.

crate_anon.crateweb.research.views.all_text_from_pid_with_db(request: django.http.request.HttpRequest, dbname: str) → django.http.response.HttpResponse[source]

Clinician view to look up a patient’s RID from their PID and display text from any field.

crate_anon.crateweb.research.views.common_find_text(request: django.http.request.HttpRequest, dbinfo: crate_anon.crateweb.research.research_db_info.SingleResearchDatabase, form_class: Type[crate_anon.crateweb.research.forms.SQLHelperTextAnywhereForm], default_values: Dict[str, Any], permit_pid_search: bool, html_filename: str) → django.http.response.HttpResponse[source]

Creates SQL to find text anywhere in the database(s) via a UNION query.

crate_anon.crateweb.research.views.get_highlight_descriptions(highlight_dict: Dict[int, List[crate_anon.crateweb.research.models.Highlight]]) → List[str][source]

Returns a list of length up to N_CSS_HIGHLIGHT_CLASSES of HTML elements illustrating the highlights.

crate_anon.crateweb.research.views.highlight_edit_select(request: django.http.request.HttpRequest) → django.http.response.HttpResponse[source]

Edit or select highlighting for current query.

crate_anon.crateweb.research.views.pid_rid_lookup(request: django.http.request.HttpRequest, with_db_url_name: str, html_filename: str) → django.http.response.HttpResponse[source]

Common functionality for pidlookup, ridlookup.

crate_anon.crateweb.research.views.pid_rid_lookup_with_db(request: django.http.request.HttpRequest, dbname: str, form_html_filename: str, formclass: Any, result_html_filename: str) → django.http.response.HttpResponse[source]

Common functionality for pidlookup_with_db, ridlookup_with_db.

crate_anon.crateweb.research.views.pidlookup(request: django.http.request.HttpRequest) → django.http.response.HttpResponse[source]

Look up PID information from RID information.

crate_anon.crateweb.research.views.pidlookup_with_db(request: django.http.request.HttpRequest, dbname: str) → django.http.response.HttpResponse[source]

Look up PID information from RID information, for a specific database.

crate_anon.crateweb.research.views.query_build(request: django.http.request.HttpRequest) → django.http.response.HttpResponse[source]

Assisted query builder, based on the data dictionary.

crate_anon.crateweb.research.views.query_count(request: django.http.request.HttpRequest, query_id: str) → django.http.response.HttpResponse[source]

View COUNT(*) from specific query.

crate_anon.crateweb.research.views.query_count_current(request: django.http.request.HttpRequest) → django.http.response.HttpResponse[source]

View COUNT(*) from current query.

crate_anon.crateweb.research.views.query_edit_select(request: django.http.request.HttpRequest) → django.http.response.HttpResponse[source]

Edit or select SQL for current query.

crate_anon.crateweb.research.views.query_results(request: django.http.request.HttpRequest, query_id: str) → django.http.response.HttpResponse[source]

View results of chosen query, in tabular format

crate_anon.crateweb.research.views.query_results_recordwise(request: django.http.request.HttpRequest, query_id: str) → django.http.response.HttpResponse[source]

View results of chosen query, in tabular format

crate_anon.crateweb.research.views.query_submit(request: django.http.request.HttpRequest, sql: str, run: bool = False) → django.http.response.HttpResponse[source]

Ancillary function to add a query, and redirect to the editing or run page.

crate_anon.crateweb.research.views.query_tsv(request: django.http.request.HttpRequest, query_id: str) → django.http.response.HttpResponse[source]

Download TSV of current query.

crate_anon.crateweb.research.views.render_lookup(request: django.http.request.HttpRequest, dbinfo: crate_anon.crateweb.research.research_db_info.SingleResearchDatabase, result_html_filename: str, trids: List[int] = None, rids: List[str] = None, mrids: List[str] = None, pids: List[int] = None, mpids: List[int] = None) → django.http.response.HttpResponse[source]

Shows the output of a PID/RID lookup.

crate_anon.crateweb.research.views.render_resultcount(request: django.http.request.HttpRequest, query: crate_anon.crateweb.research.models.Query) → django.http.response.HttpResponse[source]

Displays the number of rows that a given query will fetch.

crate_anon.crateweb.research.views.ridlookup(request: django.http.request.HttpRequest) → django.http.response.HttpResponse[source]

Look up RID information from PID information.

crate_anon.crateweb.research.views.ridlookup_with_db(request: django.http.request.HttpRequest, dbname: str) → django.http.response.HttpResponse[source]

Look up RID information from PID information, for a specific database.

crate_anon.crateweb.research.views.sqlhelper_text_anywhere(request: django.http.request.HttpRequest) → django.http.response.HttpResponse[source]

Picks a database, then redirects to sqlhelper_text_anywhere_with_db.

crate_anon.crateweb.research.views.sqlhelper_text_anywhere_with_db(request: django.http.request.HttpRequest, dbname: str) → django.http.response.HttpResponse[source]

Creates SQL to find text anywhere in the database(s) via a UNION query.

crate_anon.crateweb.research.views.textfinder_sql(patient_id_fieldname: str, fragment: str, min_length: int, use_fulltext_index: bool, include_content: bool, include_datetime: bool, patient_id_value: Union[int, str] = None, extra_fieldname: str = None, extra_value: Union[int, str] = None) → str[source]

Returns SQL to find the text in fragment across all tables that contain the field indicated by patient_id_fieldname, where the length of the text field is at least min_length.

use_fulltext_index: use database full-text indexing include_content: include the text fields in the output patient_id_value: restrict to a single patient

Will raise ValueError if no tables match the request.

crate_anon.crateweb.research.views.validate_blank_form(request: django.http.request.HttpRequest) → None[source]

Checks that the request is (a) a POST request, and (b) passes CRSF validation.