models.py

This module includes the definition for the HealthPerson model.

The polymorphic model HealthPerson is used as a baseclass for thedifferent models coupled to Remote Care roles:

Inheritance diagram of apps.healthperson.management.models.Manager, apps.healthperson.secretariat.models.Secretary, apps.healthperson.patient.models.Patient, apps.healthperson.healthprofessional.models.HealthProfessional

The HealthPerson is set as a “ForeignKey” on the apps.account.models.User user model. This allows every user to have a different model corresponding to their role.

Class definitions:

class apps.healthperson.models.HealthPerson(*args, **kwargs)[source]

Bases: polymorphic.models.PolymorphicModel

The healthperson is the polymorphic model baseclass for the different user models in Remote Care:
  • Healthprofessional
  • manager
  • patient
  • secretary

The HealthPerson is set as a “ForeignKey” on the apps.account.models.User user model. This allows every user to have a different model corresponding to their role.

Parameters:
  • id (AutoField) –
  • polymorphic_ctype_id (ForeignKey to ContentType) –
  • added_on (DateField) –
  • added_by_id (ForeignKey to HealthPerson) –
health_person_id

The health_person_id (=self.id) is not directly used in url’s of healthperson’s but is stored in the session with a random key instead. This random key is included in the url’s and used in the views to get the id of the healthperson. This way the id’s are completely invisible for users and makes it impossible to easy switch to data of another user.

In an older version the HealhPerson had a seperate health_person_id field, this has been replaced with the ‘id’ field. In order to not have to change all the templates it has been added as a property.

Returns:
self.id