iReporter enables any/every citizen to bring any form of corruption to the notice of appropriate authorities and the general public. Users can also report on things that need government intervention around the community
- Users can create an account and log in.
- Users can create a redflag record (An incident linked to corruption)
- Users can create intervention record (a call for a government agency to intervene e.g repair bad road sections, collapsed bridges, flooding e.t.c).
- Users can edit their redflag or intervention records.
- Users can delete their redflag or intervention records.
- Users can add geolocation (Lat Long Coordinates) to their redflag or intervention records .
- Users can change the geolocation (Lat Long Coordinates) attached to their redflag or intervention records .
- Admin can change the status of a record to either under investigation, rejected (in the event of a false claim) or resolved ( in the event that the claim has been investigated and resolved)
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
- A working computer with Windows OS, Linux OS, Mac OS.
- A text editor
- Postman to consume the API endpoints
- Git for Version control
- Python 3.6
- Pytest for testing the api
Open the directory you are going to work from and clone this project using this link
Open your terminal or console and navigate to your working directory then enter the following commands to create a virtual environment, install all the requirements, create a database, activate the database path and run the API respectively
$ mkvirtualenv venv
$ pip install -r requirements.txt
$ python run.py
$ sudo -u postgres psql
$ source .env
$ CREATE DATABASE ireporter;
The API is hosted on Heroku
- Install Pytest
$ pip install pytest
- Navigate to project root
- Use
pytest
to run the tests - To have a more detailed look at the tests use
pytest -v
Prefix api/v2/
to all api endpoints below
METHOD | URL | ACTION |
---|---|---|
GET | /redflag |
Get a list of all redflags |
GET | /redflag/<int:redflagId> |
Get Redflags by redflagId field |
GET | /intervention |
Get a list of all interventions |
GET | /intervention/<int:interventionId> |
Get Interventions by interventionId field |
GET | /users |
Get all users |
GET | /users |
fetch all users |
GET | /users/<int:userId> |
fetch one user by userId |
POST | /auth/signup |
Register a user to the system |
POST | /auth/login |
Login to the system |
POST | /redflag |
Post a Redflag |
POST | /intervention |
Post an Intervention |
PATCH | /redflag/<int:redflagId>/location |
Edit redflag location by incidentId field |
PATCH | /redflag/<int:redflagId>/comment |
Edit redflag comment by incidentId field |
PATCH | /redflags/<int:redflagId>/status |
Edit redflag record status by redflagId field |
PATCH | /intervention/<int:interventionId>/location |
Edit intervention location by interventionId field |
PATCH | /intervention/<int:interventionId>/comment |
Edit redflag intervention comment by interventionId field |
PATCH | /intervention/<int:interventionId>/status |
Edit redflag intervention status by interventionId field |
DELETE | /redflag/<int:redflagId> |
Delete redflag record with given redflagId |
DELETE | /redflag/<int:redflagId> |
delete redflag record by redflagId |
DELETE | /intervention/<int:interventionId> |
delete intervention record by interventionId |
DELETE | /users/<int:userId> |
delete one user by userId |
- Python 3.6
- Flask (Python microframework)
- PostgreSQL
- Sublime Text
- VS Code
- Virtual environment
- Pylint
- Pytest
- PostgreSQL
This is version 1 of the API
- Special Thanks to God Almighty
- Special Thanks to Andela
- Special Thanks to Andela KLA Bootcamp 15 members