Add documentation

This commit is contained in:
2020-05-18 14:22:52 +02:00
parent 2fa124f529
commit e761864c3e
19 changed files with 621 additions and 9 deletions

View File

@ -8,6 +8,21 @@ from apps.polyclinic.models import Polyclinic
# Create your models here.
class Employee(MetaDataModel):
"""
A model that holds the employee information that is not available in the normal user model. It has a One To One relation with the Djano User model
It will inherit the attributes :attr:`~lib.models.base.MetaDataModel.created_at` and :attr:`~lib.models.base.MetaDataModel.updated_at` from the Abstract model :class:`~lib.models.base.MetaDataModel`
Attributes
----------
user : User
The Django user in the system where this employee data belongs to.
hospital : Hospital
The hospital where this employee is working. You can only choose **one** hospital per employee.
polyclinic : Polyclinic
The polyclinic where this employee is working within the hospital. It is possible to have / work for multiple polyclinics.
phone : str
Holds the direct phone number of this employee. Max length is 20 characters.
"""
class Meta:
verbose_name = _('employee')
@ -18,8 +33,8 @@ class Employee(MetaDataModel):
hospital = models.ForeignKey(Hospital, on_delete=models.CASCADE, help_text=_('Select the hospital for this employee'))
polyclinic = models.ManyToManyField(Polyclinic, blank=True, help_text=_('Select the polyclinic(s) for this employee'))
phone = models.CharField(_('Phone number'), max_length=15, blank=True, help_text=_('The direct phone number of this employee'))
phone = models.CharField(_('Phone number'), max_length=20, blank=True, help_text=_('The direct phone number of this employee'))
def __str__(self):
"""str: Returns a readable name for the hospital. Format is [hospital_name] ([city])."""
"""str: Returns a readable name for the employee. Format is [employee_full_name] ([city])."""
return '{} ({})'.format(self.user.get_full_name(), self.hospital)

View File

@ -5,6 +5,23 @@ from lib.models.base import MetaDataModel
# Create your models here.
class Hospital(MetaDataModel):
"""
A model that holds the hospital information. This is just basic information just for getting in contact.
It will inherit the attributes :attr:`~lib.models.base.MetaDataModel.created_at` and :attr:`~lib.models.base.MetaDataModel.updated_at` from the Abstract model :class:`~lib.models.base.MetaDataModel`
Attributes
----------
name : str
The name of the hospital. Max length is 200 characters.
address : str
The address of the hospital. Street and housenumber. Max length is 200 characters.
postal_code : str
The postcalcode of the hospital. Max length is 10 characters.
city : str
The city where this hospital is located. Max length is 60 characters.
phone : str
The general phone number of this hospital. Max length is 20 characters.
"""
class Meta:
verbose_name = _('hospital')
@ -14,7 +31,7 @@ class Hospital(MetaDataModel):
address = models.CharField(_('Address'), max_length=200, blank=True, help_text=_('The address of this hospital'))
postal_code = models.CharField(_('Postal code'), max_length=10, blank=True, help_text=_('The postal code of this hospital'))
city = models.CharField(_('City'), max_length=60, blank=True, help_text=_('The city of this hospital'))
phone = models.CharField(_('Phone number'), max_length=18, blank=True, help_text=_('The general phone number of this hospital'))
phone = models.CharField(_('Phone number'), max_length=20, blank=True, help_text=_('The general phone number of this hospital'))
def __str__(self):
"""str: Returns a readable name for the hospital. Format is [hospital_name] ([city])."""

View File

@ -6,6 +6,19 @@ from apps.hospital.models import Hospital
# Create your models here.
class Polyclinic(MetaDataModel):
"""
A model that holds the polyclinic information. This is just basic information just for getting in contact.
It will inherit the attributes :attr:`~lib.models.base.MetaDataModel.created_at` and :attr:`~lib.models.base.MetaDataModel.updated_at` from the Abstract model :class:`~lib.models.base.MetaDataModel`
Attributes
----------
hospital : Hospital
The hospital where this polyclinic belongs to.
name : str
The name of the polyclinic. Max length is 200 characters.
phone : str
The general/direct phone number of this polyclinic. Max length is 20 characters.
"""
class Meta:
verbose_name = _('polyclinic')
@ -13,8 +26,8 @@ class Polyclinic(MetaDataModel):
hospital = models.ForeignKey(Hospital, on_delete=models.CASCADE, help_text=_('To which hospital belongs this polyclinic'))
name = models.CharField(_('Name'), max_length=200, blank=True, help_text=_('The name of this polyclinic'))
phone = models.CharField(_('Phone number'), max_length=18, blank=True, help_text=_('The general/direct phone number of this polyclinic'))
phone = models.CharField(_('Phone number'), max_length=20, blank=True, help_text=_('The general/direct phone number of this polyclinic'))
def __str__(self):
"""str: Returns a readable name for the hospital. Format is [hospital_name] ([city])."""
"""str: Returns a readable name for the polyclinic. Format is [polyclinic_name] ([hospital_name])."""
return '{} ({})'.format(self.name, self.hospital)

View File

@ -9,6 +9,19 @@ import collections
# Create your models here.
class Schedule(MetaDataModel):
"""
A model that holds the schedule information. Here we store the form data and let the Peregrine cluster make the calculations.
It will inherit the attributes :attr:`~lib.models.base.MetaDataModel.created_at` and :attr:`~lib.models.base.MetaDataModel.updated_at` from the Abstract model :class:`~lib.models.base.MetaDataModel`
Attributes
----------
employee : Employee
The employee that is the owner of this schedule.
name : str
The name of the schedule. Max length is 100 characters.
email : str
The email address where the results should be sent to. Max length is 100 characters.
"""
class Meta:
verbose_name = _('schedule')

View File

@ -11,7 +11,7 @@ ALLOWED_HOSTS=127.0.0.1,localhost
INTERNAL_IPS=127.0.0.1
# Enter the database url connection: https://github.com/jacobian/dj-database-url
DATABASE_URL=sqlite:////opt/deploy/VRE/VirtualResearchEnvironment/db.sqlite3
DATABASE_URL=sqlite:////opt/poli_planning/polyclinic_scheduling/db.sqlite3
# The location on disk where the static files will be placed during deployment. Setting is required
STATIC_ROOT =

View File

@ -1 +0,0 @@