15.2.143. camcops_server.cc_modules.cc_taskschedule

camcops_server/cc_modules/cc_taskschedule.py


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


class camcops_server.cc_modules.cc_taskschedule.PatientTaskSchedule(**kwargs)[source]

Joining table that associates a patient with a task schedule

__init__(**kwargs)

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.

find_scheduled_task(req: CamcopsRequest, tsi: TaskScheduleItem, start_datetime: pendulum.datetime.DateTime, end_datetime: pendulum.datetime.DateTime) → Optional[camcops_server.cc_modules.cc_task.Task][source]

Returns the most recently uploaded task that matches the patient (by any ID number, i.e. via OR), task type and timeframe

class camcops_server.cc_modules.cc_taskschedule.PatientTaskScheduleEmail(**kwargs)[source]

Represents an email send to a patient for a particular task schedule.

__init__(**kwargs)

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.

class camcops_server.cc_modules.cc_taskschedule.ScheduledTaskInfo(shortname: str, tablename: str, is_anonymous: bool, task: Optional[camcops_server.cc_modules.cc_task.Task] = None, start_datetime: Optional[pendulum.datetime.DateTime] = None, end_datetime: Optional[pendulum.datetime.DateTime] = None)[source]

Simple representation of a scheduled task (which may also contain the actual completed task, in its task member, if there is one).

__init__(shortname: str, tablename: str, is_anonymous: bool, task: Optional[camcops_server.cc_modules.cc_task.Task] = None, start_datetime: Optional[pendulum.datetime.DateTime] = None, end_datetime: Optional[pendulum.datetime.DateTime] = None) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_taskschedule.TaskSchedule(**kwargs)[source]

A named collection of task schedule items

__init__(**kwargs)

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.

class camcops_server.cc_modules.cc_taskschedule.TaskScheduleEmailTemplateFormatter[source]
__init__()[source]

Args: allowed_keys:

Keys that are permitted within a brace-delimited format string.

class camcops_server.cc_modules.cc_taskschedule.TaskScheduleItem(**kwargs)[source]

An individual item in a task schedule

__init__(**kwargs)

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.

camcops_server.cc_modules.cc_taskschedule.task_schedule_item_sort_order() → Tuple[Cast, Cast][source]

Returns a tuple of sorting functions for use with SQLAlchemy ORM queries, to sort task schedule items.

The durations are currently stored as seconds e.g. P0Y0MT2594592000.0S and the seconds aren’t zero padded, so we need to do some processing to get them in the order we want.

This will fail if durations ever get stored any other way.