This is a web-based application for managing ITN (Insecticide-Treated Nets) distribution data. The system allows users to register and log in, submit ITN distribution data, and retrieve distribution records via an API. It is built using Python Django and Django Ninja API.
- User Authentication: Users can register and log in using Django's built-in authentication system.
- ITN Distribution Data Submission: Users can submit details about ITN distribution including household ID, household head name, family members, ITNs distributed, and distribution date.
- API Endpoints:
- POST endpoint for submitting ITN distribution data.
- GET endpoint for retrieving all ITN distribution records.
- Technical Support Page: Displays the 3-tier support system for ITN distribution.
- Backend: Django, Django Ninja API
- Frontend: HTML, CSS (styled with CRS ITN brand colors)
- Database: SQLite (default, can be changed to any supported by Django)
- Authentication: Django's built-in
django.contrib.auth
Python: Ensure Python 3.x is installed on your machine. You can download it from Python.org. Django: You will need Django installed, which you can get via pip. SQLite: It comes bundled with Python, so no separate installation is required.
- Python 3.x
- Django
- Ninja API
-
Clone the repository:
git clone https://github.com/Bgumel/CRS-ITN.git cd CRS-ITN -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use: `venv\Scripts\activate`
-
Install dependencies:
pip install -r requirements.txt
-
Apply migrations:
python manage.py migrate
-
Run the development server:
python manage.py runserver
The application will now be available at http://127.0.0.1:8000.
The API provides the following endpoints for managing ITN distribution records.
Submit ITN distribution data.
- Required Fields:
household_id: The unique ID of the household.household_head_name: Name of the household head.number_of_family_members: Total number of family members in the household.itns_distributed: Number of ITNs distributed.distribution_date: The date of distribution (YYYY-MM-DD).distributor_id: The ID of the user distributing the ITNs.
{
"household_id": "123",
"household_head_name": "John Doe",
"number_of_family_members": 5,
"itns_distributed": 3,
"distribution_date": "2024-09-21",
"distributor_id": 1
}Retrieve all ITN distribution records in JSON format.
[
{
"household_id": "HH123",
"household_head_name": "John Doe",
"number_of_family_members": 5,
"itns_distributed": 3,
"distribution_date": "2024-09-19",
"distributor_id": 1
}
}
]Retrieve ITN distribution records by distributor_id in JSON format.
[
{
"household_id": "1",
"household_head_name": "Sadiq",
"number_of_family_members": 2,
"itns_distributed": 20,
"distribution_date": "2024-09-23",
"distributor_id": 1
},
{
"household_id": "12",
"household_head_name": "Sani",
"number_of_family_members": 1,
"itns_distributed": 1,
"distribution_date": "2024-09-23",
"distributor_id": 1
}
]You can view the API documentation in your browser once you set it up on localhost at http://127.0.0.1:8000/api/docs.
This project is licensed under the MIT License. See the LICENSE file for details.