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
cd
into the directory you want to clone this repository. - Run
git clone https://github.com/ifeekz/wpc_api.git
to clone this project. - Run
cd wpc_api
to get into the project directory. - Run
python -m venv wpc_venv
to create a virtal environment - Run
wpc_venv\Scripts\activate
to activate the virtal environment - Run
python -m pip install --upgrade pip
to install or upgrade pip - Run
pip install -r requirements.txt
to install dependencies - Run
copy .env.example .env
to copy the environment wariables - Run
python manage.py migrate
to setup DB migrations
- Open a terminal and
cd
into the directory you want to clone this repository. - Run
git clone https://github.com/ifeekz/wpc_api.git
to clone this project. - Run
cd wpc_api
to get into the project directory. - Run
python3 -m venv wpc_venv
to create a virtal environment - Run
source wpc_venv\Scripts\activate
or. wpc_venv\Scripts\activate
to activate the virtual environment - Run
python -m pip install --upgrade pip
orpython -m pip install -U --force-reinstall pip
to install or upgrade pip - Run
pip install -r requirements.txt
to install dependencies - Run
cp .env.example .env
to copy the environment wariables - Run
python manage.py migrate
to setup DB migrations
To use the application follow these instructions:
-
Run
python manage.py runserver
to start the server -
To create cycles, use this endpoint using any endpoint testing tool like postman:
POST:
http://localhost:8000/womens-health/api/create-cycles
Header:
Accept: application/json
Body (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-event
Header:
Accept: application/json
Query Parameters (sample):
{date: '2021-01-19'}
Quit the server (Ctrl + C
or Cmd +C
) and run python manage.py test
to run the tests