15.2.152. camcops_server.cc_modules.cc_specialnote


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/>.

Special notes that are attached, on the server, to tasks or patients.

class camcops_server.cc_modules.cc_specialnote.SpecialNote(**kwargs)[source]

Represents a special note, attached server-side to a task or patient.

“Task” means all records representing versions of a single task instance, identified by the combination of {id, device, era}.


A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

classmethod forcibly_preserve_special_notes_for_device(req: camcops_server.cc_modules.cc_request.CamcopsRequest, device_id: int) None[source]

Force-preserve all special notes for a given device.


For update methods, see also: https://docs.sqlalchemy.org/en/latest/orm/persistence_techniques.html

get_group_id_of_target() Optional[int][source]

Returns the group ID for the object (task or patient) that this special note is about.

get_note_as_html() str[source]

Return an HTML-formatted version of the note.

get_note_as_string() str[source]

Return a string-formatted version of the note.

classmethod get_specialnote_by_id(dbsession: sqlalchemy.orm.session.Session, note_id: int) Optional[camcops_server.cc_modules.cc_specialnote.SpecialNote][source]

Returns a special note, given its ID.

get_xml_root(skip_fields: Optional[List[str]] = None) camcops_server.cc_modules.cc_xml.XmlElement[source]

Get root of XML tree, as an camcops_server.cc_modules.cc_xml.XmlElement.

refers_to_patient() bool[source]

Is this a note relating to a patient, rather than a task?

refers_to_task() bool[source]

Is this a note relating to a task, rather than a patient?

target_patient() Optional[Patient][source]

Get the patient to which this note refers, or None if it doesn’t.

target_task() Optional[Task][source]

Get the patient to which this note refers, or None if it doesn’t.

user_may_delete_specialnote(user: camcops_server.cc_modules.cc_user.User) bool[source]

May the specified user delete this note?