Web portal that enables communication between hospitals and health authorities
This project contains a Python server built using Django. It contains an API layer that connects to a PostgresSQL database. The frontend is a single-page app built using React, and it's contained in the frontend
directory. We use Bootstrap for layouts. We don't (yet?) need Redux, and we try to keep things simple there. No server-side rendering is currently considered, but it may be in the future.
master
.npm test
to make sure you didn't break anything!master
!This project was bootstrapped with Create React App.
In the project directory (frontend/
), you can run:
npm install
Downloads dependencies and allows you to build and develop the app.
npm start
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
npm test
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
npm run build
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
npm run eject
Note: this is a one-way operation. Once you eject
, you can’t go back!
If you aren’t satisfied with the build tool and configuration choices, you can eject
at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject
will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
You don’t have to ever use eject
. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
You can learn more in the Create React App documentation.
To learn React, check out the React documentation.
To get your development environment up and running, follow these steps:
pip install -r requirements.txt
to install all the necessary dependencies.useful_scripts/install_dependencies.sh
. This will require root access. If you have installed
Docker, then this will also set up the Postgres Docker container, with the username and password user001
and 123456789
respectively.useful_scripts/deploy.sh
, which if you open the file, will run npm run dev
which runs Webpack and Babel to generate a main.js
in frontend/static/frontend/
, which is what the Python
server serves to the user. This can be done manually or by running this script. This script also copies the infomed/example.env
into infomed/.env
, which is sufficient, but SHOULD NOT BE USED WHEN DEPLOYED IN PRODUCTION. That file contains the database username, password, and secret keys which SHOULD BE CHANGED before we deploy. To do so, copy infomed/example.env
into infomed/.env
and modify manually the .env
file.python manage.py runserver
.The backend is structured as follows:
views.py
file. ModelViewset
class, which has prewritten endpoints
for HTTP GET
, POST
, PUT
, etc. More information can be found here:
[https://www.django-rest-framework.org/api-guide/viewsets/.] ModelSerializer
class in the DRF as well as the GeoFeatureModelSerializer
class, an add-on to the
rest framework. GeoFeatureModelSerializer
is used to serialize geometries.router.py
. Finally, we can write unit tests to test our API in tests.py
.