13.2.41. camcops_server.cc_modules.cc_exportrecipientinfo


Copyright (C) 2012-2019 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/>.

ExportRecipientInfo class.

The purpose of this is to capture information without using an SQLAlchemy class. The camcops_server.cc_modules.cc_config.CamcopsConfig class uses this, as it needs to be readable in the absence of a database connection (q.v.).

class camcops_server.cc_modules.cc_exportrecipientinfo.ConfigParamExportRecipient[source]

Possible configuration file parameters that relate to “export recipient” definitions.

class camcops_server.cc_modules.cc_exportrecipientinfo.ExportRecipientInfo(other: Optional[camcops_server.cc_modules.cc_exportrecipientinfo.ExportRecipientInfo] = None)[source]

Class representing an export recipient, that is not an SQLAlchemy ORM object.

This has an unfortunate close relationship with camcops_server.cc_modules.cc_exportrecipient.ExportRecipient (q.v.).

Full details of parameters are in the docs for the config file.

Initializes, optionally copying attributes from other.

anonymous_ok() → bool[source]

Does this recipient permit/want anonymous tasks?

classmethod create_dummy_recipient() → camcops_server.cc_modules.cc_exportrecipientinfo.ExportRecipientInfo[source]

Creates and returns a dummy ExportRecipientInfo.

get_attrnames() → List[str][source]

Returns all relevant attribute names.

get_email_body(req: CamcopsRequest, task: Task) → str[source]

Gets a substituted e-mail body.

get_email_subject(req: CamcopsRequest, task: Task) → str[source]

Gets a substituted e-mail subject.

get_eq_attrnames() → List[str][source]

Returns attribute names to use for equality comparison.

get_filename(req: CamcopsRequest, task: Task, override_task_format: str = '') → str[source]

Get the export filename, for file transfers.

static get_hl7_id_aa(req: CamcopsRequest, which_idnum: int) → str[source]

Get the HL7 Assigning Authority for a specific CamCOPS ID number type.

static get_hl7_id_type(req: CamcopsRequest, which_idnum: int) → str[source]

Get the HL7 ID type for a specific CamCOPS ID number type.

is_incremental() → bool[source]

Is this an incremental export? (That’s the norm, except for database exports.)

classmethod read_from_config(parser: configparser.ConfigParser, recipient_name: str) → camcops_server.cc_modules.cc_exportrecipientinfo.ExportRecipientInfo[source]

Reads from the config file and writes this instance’s attributes.

  • parser – configparser INI file object
  • recipient_name – name of recipient and of INI file section

an ExportRecipient object, which is not currently in a database session

classmethod report_error(msg: str) → None[source]

Report an error to the log.

using_db() → bool[source]

Is the recipient a database?

using_email() → bool[source]

Is the recipient an e-mail system?

using_file() → bool[source]

Is the recipient a filestore?

using_hl7() → bool[source]

Is the recipient an HL7 recipient?

valid(req: CamcopsRequest) → bool[source]

Is this definition valid?

Parameters:req – a camcops_server.cc_modules.cc_request.CamcopsRequest
validate(req: CamcopsRequest) → None[source]

Validates all aspects.

Parameters:req – a camcops_server.cc_modules.cc_request.CamcopsRequest
Raises:InvalidExportRecipient if invalid
validate_db_dependent(req: CamcopsRequest) → None[source]

Validates the database-dependent aspects of the ExportRecipient, or raises InvalidExportRecipient.

validate_db_independent() should have been called first; this function presumes that those checks have been passed.

Parameters:req – a camcops_server.cc_modules.cc_request.CamcopsRequest
validate_db_independent() → None[source]

Validates the database-independent aspects of the ExportRecipient, or raises InvalidExportRecipient.

class camcops_server.cc_modules.cc_exportrecipientinfo.ExportTransmissionMethod[source]

Possible export transmission methods.

exception camcops_server.cc_modules.cc_exportrecipientinfo.InvalidExportRecipient(recipient_name: str, msg: str)[source]

Exception for invalid export recipients.