helperFunctions

class fhir_biobank.helperFunctions.Helper[source]

Bases: object

This class defines static methods that are used in converting Classes and their information into a FHIR representation, and creating correct codes and codeable concepts for FHIR representation of the resources.

static create_codeable_concept(list_of_codings: List[fhirclient.models.coding.Coding], text: Optional[str] = None)[source]

This method creates a CodeableConcept - reference to a terminology or a text. List of coding resources is required to create a codeable concept.

Parameters
  • list_of_codings (List[Coding]) – A reference to a code defined by a terminology system

  • text (string) – A human language representation of the code

Returns

FHIR CodeableConcept

Raises
  • TypeError – This exception is raised when incorrect types of arguments are provided

  • ValueError – This exception is raised when incorrect value in argument is provided

static create_coding(code: str, system: Optional[str] = None, version: Optional[str] = None, display: Optional[str] = None, user_selected: bool = True)[source]

This method creates a reference to a code defined by a terminology system.

Parameters
  • code (string) – Symbol in syntax defined by the system. This symbol can be predefined code or and expression defined by the coding system. See for example IDENTIFIER_TYPE_CODES

  • system (string) – the identification of the code system that defines the meaning of symbol in the code

  • version (string) – the version of the code system which was used when choosing this code.

  • display (string) – representation of the meaning of the code in the system

  • user_selected (bool) – true/false value indicating if the coding was chosen by user directly for example: off a pick list of available items (codes or displays.)

Returns

FHIR Coding resource

Raises

TypeError – This exception is raised when incorrect types of arguments are provided

static create_fhir_reference(reference: str)[source]

This method creates correct FHIR object that represents a reference to another FHIR object. For example SpecimenResource uses reference on PatientResource to indicate that the collected specimen comes from the referenced patient.

Parameters

reference (string) – String that references resource. for example. “Patient/patient.id”

Returns

FHIRReference obtaining provided reference.

static create_identifier(value: str, use: str = 'usual', identifier_type: str = 'ACSN')[source]

this function creates an identifier for a resource. Identification number is encouraged to use as a value.

Parameters
  • value (string) – value of identifier. Identification number is encouraged to use

  • use (Optional[string]) – purpose of this identifier. default value is “usual”. correct values are : “usual”, “official”, “temp”, “secondary”, “old”

  • identifier_type (Optional[string]) – a coded type for the identifier that can be used to determine specific purpose of the identifier. default value is “MR” correct values are : “DL”, “PPN”, “BRN”, “MR”, “MCN”, “EN”, “TAX”, “NIIP”,”PRN”, “MD”, “DR”, “ACSN”, “UDI”, “SNO”, “SB”, “PLAC”, “FILL”, “JHN”. For more info see https://simplifier.net/packages/hl7.fhir.r4.core/4.0.1/files/82653

Returns

Identifier used in resources

Raises
  • TypeError – This exception is raised when incorrect types of arguments are provided

  • ValueError – This exception is raised when incorrect value in argument is provided