A REST API that helps estimate a woman’s period cycles within a specific timeframe and also determine what period of her monthly cycle a lady is currently in.
- Python >= 3.8
- Pip
Dependencies (will be installed on step 6 in next section):
- Django~=3.2.8
- djangorestframework==3.12.4
- django-environ==0.7.0
- Open a terminal and
cdinto the directory you want to clone this repository. - Run
git clone https://github.com/ifeekz/wpc_api.gitto clone this project. - Run
cd wpc_apito get into the project directory. - Run
python -m venv wpc_venvto create a virtal environment - Run
wpc_venv\Scripts\activateto activate the virtal environment - Run
python -m pip install --upgrade pipto install or upgrade pip - Run
pip install -r requirements.txtto install dependencies - Run
copy .env.example .envto copy the environment wariables - Run
python manage.py migrateto setup DB migrations
- Open a terminal and
cdinto the directory you want to clone this repository. - Run
git clone https://github.com/ifeekz/wpc_api.gitto clone this project. - Run
cd wpc_apito get into the project directory. - Run
python3 -m venv wpc_venvto create a virtal environment - Run
source wpc_venv\Scripts\activateor. wpc_venv\Scripts\activateto activate the virtual environment - Run
python -m pip install --upgrade piporpython -m pip install -U --force-reinstall pipto install or upgrade pip - Run
pip install -r requirements.txtto install dependencies - Run
cp .env.example .envto copy the environment wariables - Run
python manage.py migrateto setup DB migrations
To use the application follow these instructions:
-
Run
python manage.py runserverto start the server -
To create cycles, use this endpoint using any endpoint testing tool like postman:
POST:
http://localhost:8000/womens-health/api/create-cyclesHeader:
Accept: application/jsonBody (sample):
{ "last_period_date": "2020-06-20", "cycle_average": 25, "period_average": 5, "start_date": "2020-07-25", "end_date": "2021-07-25" } -
To get cycle event for a date use
GET:
http://localhost:8000/womens-health/api/cycle-eventHeader:
Accept: application/jsonQuery Parameters (sample):
{date: '2021-01-19'}
Quit the server (Ctrl + C or Cmd +C) and run python manage.py test to run the tests