Patient

class patient.nh_clinical_patient(pool, cr)[source]

Represents a patient.

check_data(*args, **kwargs)[source]

Default will check if patient exists. Either hospital number (other_identifier) or NHS number (patient_identifier) is required.

If create is True, then both other_identifier and patient_identifier must be unique. Otherwise either or both identifiers will be accepted in data parameter.

If title is in data parameter, then method changes title to res.partner.title id. If title is not included, a new title will be created.

Parameters:
  • data (dict) – must include either patient_identifier or other_identifier
  • create (bool) – True [default]
  • exception – if True [default], it will raise an exception if no patient exists or more than one patient exists
Raises:

except_orm if exception arguments is True and if patient doesn’t exists or if duplicate patients are found

Returns:

True if successful. Otherwise False

Return type:

bool

check_hospital_number(*args, **kwargs)[source]

Checks for a patient by hospital number.

Parameters:
  • hospital_number (string) – patient’s hospital number
  • exception (bool) – True or False. Default is False
Returns:

True if patient exists. Otherwise False

Return type:

bool

Raises:

except_orm if exception is True and if the patient exists or if the patient does not

check_nhs_number(*args, **kwargs)[source]

Checks for patient by provided NHS Number.

Parameters:
  • nhs_number (string) – patient’s nhs number
  • exception (bool) – True or False. Default is False
Returns:

True if patient exists. Otherwise False

Return type:

bool

Raises:

except_orm if exception is True and if the patient exists or if the patient does not

create(*args, **kwargs)[source]

Extends Odoo’s create() to write name, other_identifier and patient_identifier upon creation.

Returns:True if created
Return type:bool
current_location_id

The value of such a field is a recordset of size 0 (no record) or 1 (a single record).

Parameters:
  • comodel_name – name of the target model (string)
  • domain – an optional domain to set on candidate values on the client side (domain or string)
  • context – an optional context to use on the client side when handling that field (dictionary)
  • ondelete – what to do when the referred record is deleted; possible values are: 'set null', 'restrict', 'cascade'
  • auto_join – whether JOINs are generated upon search through that field (boolean, by default False)
  • delegate – set it to True to make fields of the target model accessible from the current model (corresponds to _inherits)

The attribute comodel_name is mandatory except in the case of related fields or field extensions.

display_name

Very similar to Char but used for longer contents, does not have a size and usually displayed as a multiline text box.

Parameters:translate – whether the value of this field can be translated
dob
ethnicity
Parameters:
  • selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
  • selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).

The attribute selection is mandatory except in the case of related fields or field extensions.

family_name

Basic string field, can be length-limited, usually displayed as a single-line string in clients

Parameters:
  • size (int) – the maximum size of values stored for that field
  • translate (bool) – whether the values of this field can be translated
follower_ids

Many2many field; the value of such a field is the recordset.

Parameters:comodel_name – name of the target model (string)

The attribute comodel_name is mandatory except in the case of related fields or field extensions.

Parameters:
  • relation – optional name of the table that stores the relation in the database (string)
  • column1 – optional name of the column referring to “these” records in the table relation (string)
  • column2 – optional name of the column referring to “those” records in the table relation (string)

The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!

Parameters:
  • domain – an optional domain to set on candidate values on the client side (domain or string)
  • context – an optional context to use on the client side when handling that field (dictionary)
  • limit – optional limit to use upon read (integer)
format_data(fields, data, context=None)[source]
full_name

Very similar to Char but used for longer contents, does not have a size and usually displayed as a multiline text box.

Parameters:translate – whether the value of this field can be translated
gender
Parameters:
  • selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
  • selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).

The attribute selection is mandatory except in the case of related fields or field extensions.

get_not_admitted_patient_ids(*args, **kwargs)[source]

Returns patients ids for patients with no open spell.

given_name

Basic string field, can be length-limited, usually displayed as a single-line string in clients

Parameters:
  • size (int) – the maximum size of values stored for that field
  • translate (bool) – whether the values of this field can be translated
load(*args, **kwargs)[source]

Attempts to load the data matrix, and returns a list of ids (or False if there was an error and no id could be generated) and a list of messages.

The ids are those of the records created and saved (in database), in the same order they were extracted from the file. They can be passed directly to read()

Parameters:
  • fields (list(str)) – list of fields to import, at the same index as the corresponding data
  • data (list(list(str))) – row-major matrix of data to import
  • context (dict) –
Returns:

{ids: list(int)|False, messages: [Message]}

middle_names

Basic string field, can be length-limited, usually displayed as a single-line string in clients

Parameters:
  • size (int) – the maximum size of values stored for that field
  • translate (bool) – whether the values of this field can be translated
name_get(*args, **kwargs)[source]

Override name_get method so we return the patient’s fullname instead of the default name field

not_admitted
other_identifier

Basic string field, can be length-limited, usually displayed as a single-line string in clients

Parameters:
  • size (int) – the maximum size of values stored for that field
  • translate (bool) – whether the values of this field can be translated
partner_id

The value of such a field is a recordset of size 0 (no record) or 1 (a single record).

Parameters:
  • comodel_name – name of the target model (string)
  • domain – an optional domain to set on candidate values on the client side (domain or string)
  • context – an optional context to use on the client side when handling that field (dictionary)
  • ondelete – what to do when the referred record is deleted; possible values are: 'set null', 'restrict', 'cascade'
  • auto_join – whether JOINs are generated upon search through that field (boolean, by default False)
  • delegate – set it to True to make fields of the target model accessible from the current model (corresponds to _inherits)

The attribute comodel_name is mandatory except in the case of related fields or field extensions.

patient_identifier

Basic string field, can be length-limited, usually displayed as a single-line string in clients

Parameters:
  • size (int) – the maximum size of values stored for that field
  • translate (bool) – whether the values of this field can be translated
sex
Parameters:
  • selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
  • selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).

The attribute selection is mandatory except in the case of related fields or field extensions.

“Deletes” a patient from the system without deleting the record from the database. This allows the retrieval of patient data if necessary.

Parameters:ids (list) – ids of patients to unlink
Returns:True
Return type:bool
update(*args, **kwargs)[source]

Updates patient data by provided hospital number or nhs number, instead of patient_id as per usual.

Parameters:
  • identifier (str) – identifier of patient
  • data (dict) – data to write to the patient record
  • selection (str) – type of identifier used to lookup patient. Default is other_identifier, which is hospital number. patient_identifier will do it through the nhs number.
Returns:

True

Return type:

bool

write(*args, **kwargs)[source]

Extends Odoo’s write().

Returns:True if created
Return type:bool