diff --git a/.gitignore b/.gitignore index 374c8fd..4497a87 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ test *.mo db.sqlite3 .env +doc/_build/ +doc/output/ diff --git a/README.md b/README.md index 43f2cc7..fecc99c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ -# poli_planning +Het 1,5 meter ziekenhuis +======================== -Poliklinieken planning vanwege 1,5 meter afstand (Corona virus) \ No newline at end of file +Ziekenhuizen in Nederland zijn volop bezig met het hervatten van de reguliere zorg. Uitgestelde afspraken en nieuwe afspraken worden weer ingepland. De veiligheid van patiënten staat daarbij voorop. Patiënten moeten ook in een ziekenhuis onderling een afstand van 1,5 meter aanhouden in deze tijd van COVID-19. Dus in de wachtkamer moet er minimaal 1,5 meter ruimte tussen stoelen zijn. En een patiënt die naar een lege stoel loopt, mag ook lopend niet te dicht in de buurt komen van andere patiënten. Er kunnen daardoor veel minder patiënten tegelijk in een wachtkamer op hun afspraak wachten. Bijvoorbeeld een wachtkamer die vroeger 22 zitplaatsen had, heeft nu misschien nog maar 6 of 7 zitplaatsen. Het weghalen van stoelen uit de wachtkamer is meestal nog wel redelijk eenvoudig te regelen. Maar hoe kan het aantal wachtende patiënten worden beperkt? + +https://www.rug.nl/cope/projecten/het-anderhalve-meter-ziekenhuis/ + +See the doc for more information. \ No newline at end of file diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 0000000..1c19fc3 --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = output + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/doc/_static/RUG_Logo.jpg b/doc/_static/RUG_Logo.jpg new file mode 100644 index 0000000..da3037b Binary files /dev/null and b/doc/_static/RUG_Logo.jpg differ diff --git a/doc/_static/custom.css b/doc/_static/custom.css new file mode 100644 index 0000000..2852270 --- /dev/null +++ b/doc/_static/custom.css @@ -0,0 +1,10 @@ +/* override table width restrictions as found on https://github.com/getpelican/pelican/issues/1311 */ +.wy-table-responsive table td, .wy-table-responsive table th { + /* !important prevents the common CSS stylesheets from + overriding this as on RTD they are loaded after this stylesheet */ + white-space: normal !important; +} + +.wy-table-responsive { + overflow: visible !important; +} \ No newline at end of file diff --git a/doc/conf.py b/doc/conf.py new file mode 100644 index 0000000..7a287ff --- /dev/null +++ b/doc/conf.py @@ -0,0 +1,251 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import os +import sys +# sys.path.insert(0, os.path.abspath('.')) + +# Django autodoc +sys.path.insert(0, os.path.abspath('../polyclinic_scheduling')) +os.environ['DJANGO_SETTINGS_MODULE'] = 'polyclinic_scheduling.settings' +import django +django.setup() + +# -- Project information ----------------------------------------------------- + +project = 'Poliklinieken Planning Tool' +copyright = '2020, Joshua Rubingh' +author = 'Joshua Rubingh' + +# The full version, including alpha/beta/rc tags +release = '1.0' + +# The master toctree document. +master_doc = 'index' + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.napoleon', + 'sphinx.ext.autodoc', + 'sphinx.ext.viewcode', + 'sphinx.ext.coverage', + 'sphinx_markdown_builder', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = 'en' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store','build/*'] + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'alabaster' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +html_theme_options = { + 'logo': 'RUG_Logo.jpg', + 'logo_name' : True +} + +# -- Options for LaTeX output --------------------------------------------- +# Install Ubuntu/Debian package(s): texlive-latex-recommended, texlive-fonts-recommended, texlive-latex-extra, netpbm +latex_engine = 'pdflatex' +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + 'papersize': 'a4paper', + 'releasename':" ", + # Sonny, Lenny, Glenn, Conny, Rejne, Bjarne and Bjornstrup + # 'fncychap': '\\usepackage[Lenny]{fncychap}', + 'fncychap': '\\usepackage{fncychap}', + 'fontpkg': '\\usepackage{amsmath,amsfonts,amssymb,amsthm}', + + 'figure_align':'htbp', + # The font size ('10pt', '11pt' or '12pt'). + # + 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + 'preamble': r''' + %%%%%%%%%%%%%%%%%%%% Meher %%%%%%%%%%%%%%%%%% + %%%add number to subsubsection 2=subsection, 3=subsubsection + %%% below subsubsection is not good idea. + \setcounter{secnumdepth}{3} + % + %%%% Table of content upto 2=subsection, 3=subsubsection + \setcounter{tocdepth}{1} + + \usepackage{amsmath,amsfonts,amssymb,amsthm} + \usepackage{graphicx} + + %%% reduce spaces for Table of contents, figures and tables + %%% it is used "\addtocontents{toc}{\vskip -1.2cm}" etc. in the document + \usepackage[notlot,nottoc,notlof]{} + + \usepackage{color} + \usepackage{transparent} + \usepackage{eso-pic} + \usepackage{lipsum} + + \usepackage{footnotebackref} %%link at the footnote to go to the place of footnote in the text + + %% spacing between line + \usepackage{setspace} + %%%%\onehalfspacing + %%%%\doublespacing + \singlespacing + + + %%%%%%%%%%% datetime + \usepackage{datetime} + + \newdateformat{MonthYearFormat}{% + \monthname[\THEMONTH], \THEYEAR} + + + %% RO, LE will not work for 'oneside' layout. + %% Change oneside to twoside in document class + \usepackage{fancyhdr} + \pagestyle{fancy} + \fancyhf{} + + %%% Alternating Header for oneside + \fancyhead[L]{\ifthenelse{\isodd{\value{page}}}{ \small \nouppercase{\leftmark} }{}} + \fancyhead[R]{\ifthenelse{\isodd{\value{page}}}{}{ \small \nouppercase{\rightmark} }} + + %%% Alternating Header for two side + %\fancyhead[RO]{\small \nouppercase{\rightmark}} + %\fancyhead[LE]{\small \nouppercase{\leftmark}} + + %% for oneside: change footer at right side. If you want to use Left and right then use same as header defined above. + %% \fancyfoot[R]{\ifthenelse{\isodd{\value{page}}}{{\tiny Meher Krishna Patel} }{\href{http://pythondsp.readthedocs.io/en/latest/pythondsp/toc.html}{\tiny PythonDSP}}} + + %%% Alternating Footer for two side + %% %\fancyfoot[RO, RE]{\scriptsize Meher Krishna Patel (mekrip@gmail.com)} + + %%% page number + \fancyfoot[CO, CE]{\thepage} + + \renewcommand{\headrulewidth}{0.5pt} + \renewcommand{\footrulewidth}{0.5pt} + + \RequirePackage{tocbibind} %%% comment this to remove page number for following + \addto\captionsenglish{\renewcommand{\contentsname}{Table of contents}} + %% \addto\captionsenglish{\renewcommand{\listfigurename}{List of figures}} + %% \addto\captionsenglish{\renewcommand{\listtablename}{List of tables}} + %% % \addto\captionsenglish{\renewcommand{\chaptername}{Chapter}} + + + %%reduce spacing for itemize + \usepackage{enumitem} + \setlist{nosep} + + %%%%%%%%%%% Quote Styles at the top of chapter + %% \usepackage{epigraph} + %% \setlength{\epigraphwidth}{0.8\columnwidth} + %% \newcommand{\chapterquote}[2]{\epigraphhead[60]{\epigraph{\textit{#1}}{\textbf {\textit{--#2}}}}} + %%%%%%%%%%% Quote for all places except Chapter + %% \newcommand{\sectionquote}[2]{{\quote{\textit{``#1''}}{\textbf {\textit{--#2}}}}} + ''', + + + 'maketitle': r''' + \pagenumbering{Roman} %%% to avoid page 1 conflict with actual page 1 + + \begin{titlepage} + + \begingroup % for PDF information dictionary + \def\endgraf{ }\def\and{\& }% + \pdfstringdefDisableCommands{\def\\{, }}% overwrite hyperref setup + \hypersetup{pdfauthor={\@author}, pdftitle={\@title}}% + \endgroup + + \centering + + \vspace*{40mm} %%% * is used to give space from top + \textbf{\Huge {RUG Poliklinieken Planning Tool} } + + \vspace{0mm} + \begin{figure}[!h] + \centering + \includegraphics[scale=0.4]{RUG_Logo.jpg} + \end{figure} + + \vspace{100mm} + \Large \textbf{{Joshua Rubingh}} + + + \small Created on : May, 2020 + + \vspace*{0mm} + \small Last updated : \MonthYearFormat\today + + + %% \vfill adds at the bottom + \vfill + %% \small \textit{More documents are freely available at }{\href{http://pythondsp.readthedocs.io/en/latest/pythondsp/toc.html}{PythonDSP}} + \end{titlepage} + + \clearpage + \pagenumbering{roman} + \tableofcontents + \listoffigures + \listoftables + \clearpage + \pagenumbering{arabic} + ''', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', + 'sphinxsetup': \ + 'hmargin={0.7in,0.7in}, vmargin={1in,1in}, \ + verbatimwithframe=true, \ + TitleColor={rgb}{0,0,0}, \ + HeaderFamily=\\rmfamily\\bfseries, \ + InnerLinkColor={rgb}{0,0,1}, \ + OuterLinkColor={rgb}{0,0,1}', + + 'tableofcontents':' ', +} + +latex_logo = '_static/RUG_Logo.jpg' + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'documentation.tex', project, + author, 'report') +] diff --git a/doc/documentation.pdf b/doc/documentation.pdf new file mode 100644 index 0000000..e7e3e58 Binary files /dev/null and b/doc/documentation.pdf differ diff --git a/doc/index.rst b/doc/index.rst new file mode 100644 index 0000000..ead6368 --- /dev/null +++ b/doc/index.rst @@ -0,0 +1,24 @@ +.. Poliklinieken Planning documentation master file, created by + sphinx-quickstart on Mon May 18 13:21:06 2020. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +===================================================== +Welcome to Poliklinieken Planning Tool documentation! +===================================================== + +Here you can read more information about the Poliklinieken Planning Tool. + +.. toctree:: + :caption: Table of Contents + :maxdepth: 2 + + install + models + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/doc/install.rst b/doc/install.rst new file mode 100644 index 0000000..2677983 --- /dev/null +++ b/doc/install.rst @@ -0,0 +1,96 @@ +============ +Installation +============ + +In order to install this Polyclinic Schedule Tool, we use the following packages / software. + +* NGINX +* MySQL +* Django + +First we need to checkout the code. + +.. code-block:: bash + + git clone https://git.web.rug.nl/P300021/poli_planning.git /opt/poli_planning + +----- +NGINX +----- +Install NGINX. For Ubuntu this would be + +.. code-block:: console + + sudo apt install nginx + +Also configure SSL (https://letsencrypt.org/) to make the connections secure. This is outside this installation scope. + +Setup +----- +After installation of the packages, create a symbolic link in the `/etc/nginx/sites-enabled` so that a new VHost is created. + +.. code-block:: console + + ln -s /opt/poli_planning/nginx/vhost.conf /etc/nginx/sites-enabled/poli_planning + +Important parts of the VHost configuration: + +.. literalinclude:: ../nginx/vhost.conf + :language: bash + +In order to test if NGINX is configured correctly run `nginx -t` and it should give an OK message: + +.. code-block:: bash + + nginx: the configuration file /etc/nginx/nginx.conf syntax is ok + nginx: configuration file /etc/nginx/nginx.conf test is successful + +------ +Django +------ +We install Django with standard settings. We could run it in Aync way, but then you need some more steps: https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/ So for now, we keep it simple. + +Install +======= +Create a python virtual environment + +.. code-block:: bash + + cd /opt/poli_planning + python3 -m venv python3_env + source python3_env/bin/activate + +Finally we install the required Python modules + +.. code-block:: python + + pip install -r requirements + +This will install all the needed Python modules we need to run this Django project. + +Settings +-------- +The settings for Django are set in an `.env` file so that you can easily change the environment from production to testing. There is an `.env.example` file that could be used as a template. + +.. literalinclude:: ../polyclinic_scheduling/polyclinic_scheduling/.env.example + :language: jproperties + +Next we have to make the database structure. If you are using SQLite3 as a backend, make sure the database file **DOES** exist on disk. + +.. code-block:: console + + touch /opt/poli_planning/polyclinic_scheduling/db.sqlite3 + +Then in the Python virtual environment we run the following commands: + +.. code-block:: console + + ./manage.py migrate + ./manage.py compilemessages + ./manage.py collectstatic + +And finally you should be able to start the Django application + +.. code-block:: console + + ./manage.py runserver \ No newline at end of file diff --git a/doc/make.bat b/doc/make.bat new file mode 100644 index 0000000..6247f7e --- /dev/null +++ b/doc/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/doc/models.rst b/doc/models.rst new file mode 100644 index 0000000..b89a78a --- /dev/null +++ b/doc/models.rst @@ -0,0 +1,18 @@ +====== +Models +====== + +.. automodule:: lib.models.base + :members: + +.. automodule:: apps.employee.models + :members: + +.. automodule:: apps.hospital.models + :members: + +.. automodule:: apps.polyclinic.models + :members: + +.. automodule:: apps.schedule.models + :members: diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 0000000..a0489c5 --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1,2 @@ +Sphinx==3.0.0 +sphinx-markdown-builder==0.5.4 \ No newline at end of file diff --git a/nginx/vhost.conf b/nginx/vhost.conf new file mode 100644 index 0000000..a45c7ec --- /dev/null +++ b/nginx/vhost.conf @@ -0,0 +1,92 @@ +# You should look at the following URL's in order to grasp a solid understanding +# of Nginx configuration files in order to fully unleash the power of Nginx. +# https://www.nginx.com/resources/wiki/start/ +# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/ +# https://wiki.debian.org/Nginx/DirectoryStructure +# +# In most cases, administrators will remove this file from sites-enabled/ and +# leave it as reference inside of sites-available where it will continue to be +# updated by the nginx packaging team. +# +# This file will automatically load configuration files provided by other +# applications, such as Drupal or Wordpress. These applications will be made +# available underneath a path with that package name, such as /drupal8. +# +# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. +## + +# Default server configuration +# + +server { + # SSL configuration + # + # listen 443 ssl default_server; + # listen [::]:443 ssl default_server; + # + # Note: You should disable gzip for SSL traffic. + # See: https://bugs.debian.org/773332 + # + # Read up on ssl_ciphers to ensure a secure configuration. + # See: https://bugs.debian.org/765782 + # + # Self signed certs generated by the ssl-cert package + # Don't use them in a production server! + # + # include snippets/snakeoil.conf; + + root /var/www/html; + + # Add index.php to the list if you are using PHP + index index.html index.htm index.nginx-debian.html; + + server_name poli-planning.hpc.rug.nl localhost; + + access_log /var/log/nginx/poli-planning.hpc.rug.nl.access.log; + error_log /var/log/nginx/poli-planning.hpc.rug.nl.error.log; + + location /static { + alias /opt/poli_planning/static; + } + + location / { + # First attempt to serve request as file, then + # as directory, then fall back to displaying a 404. + # try_files $uri $uri/ =404; + + proxy_pass http://localhost:8000; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + + proxy_redirect off; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $server_name; + proxy_set_header X-Forwarded-Proto $scheme; + } + + listen [::]:443 ssl ipv6only=on; # managed by Certbot + listen 443 ssl; # managed by Certbot + + ssl_certificate /etc/letsencrypt/live/poli-planning.hpc.rug.nl/fullchain.pem; # managed by Certbot + ssl_certificate_key /etc/letsencrypt/live/poli-planning.hpc.rug.nl/privkey.pem; # managed by Certbot + + include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot + ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot +} + + +server { + if ($host = poli-planning.hpc.rug.nl) { + return 301 https://$host$request_uri; + } # managed by Certbot + + listen 80; + listen [::]:80; + + server_name poli-planning.hpc.rug.nl localhost; + return 404; # managed by Certbot +} + diff --git a/polyclinic_scheduling/apps/employee/models.py b/polyclinic_scheduling/apps/employee/models.py index a6ef830..6babd32 100644 --- a/polyclinic_scheduling/apps/employee/models.py +++ b/polyclinic_scheduling/apps/employee/models.py @@ -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) \ No newline at end of file diff --git a/polyclinic_scheduling/apps/hospital/models.py b/polyclinic_scheduling/apps/hospital/models.py index 9ca1d55..b1e24bb 100644 --- a/polyclinic_scheduling/apps/hospital/models.py +++ b/polyclinic_scheduling/apps/hospital/models.py @@ -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]).""" diff --git a/polyclinic_scheduling/apps/polyclinic/models.py b/polyclinic_scheduling/apps/polyclinic/models.py index ab04e5c..7ab3490 100644 --- a/polyclinic_scheduling/apps/polyclinic/models.py +++ b/polyclinic_scheduling/apps/polyclinic/models.py @@ -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) diff --git a/polyclinic_scheduling/apps/schedule/models.py b/polyclinic_scheduling/apps/schedule/models.py index 4911cf0..5422d69 100644 --- a/polyclinic_scheduling/apps/schedule/models.py +++ b/polyclinic_scheduling/apps/schedule/models.py @@ -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') diff --git a/polyclinic_scheduling/polyclinic_scheduling/.env.example b/polyclinic_scheduling/polyclinic_scheduling/.env.example index 77e285b..a7f96ec 100644 --- a/polyclinic_scheduling/polyclinic_scheduling/.env.example +++ b/polyclinic_scheduling/polyclinic_scheduling/.env.example @@ -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 = diff --git a/polyclinic_scheduling/static/.gitignore b/polyclinic_scheduling/static/.gitignore deleted file mode 100644 index 8b13789..0000000 --- a/polyclinic_scheduling/static/.gitignore +++ /dev/null @@ -1 +0,0 @@ -