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

20
doc/Makefile Normal file
View File

@ -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)

BIN
doc/_static/RUG_Logo.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

10
doc/_static/custom.css vendored Normal file
View File

@ -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;
}

251
doc/conf.py Normal file
View File

@ -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')
]

BIN
doc/documentation.pdf Normal file

Binary file not shown.

24
doc/index.rst Normal file
View File

@ -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`

96
doc/install.rst Normal file
View File

@ -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

35
doc/make.bat Normal file
View File

@ -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

18
doc/models.rst Normal file
View File

@ -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:

2
doc/requirements.txt Normal file
View File

@ -0,0 +1,2 @@
Sphinx==3.0.0
sphinx-markdown-builder==0.5.4