Skip to content

Corruption is a huge bane to Africa’s development. African countries must develop novel and localised solutions that will curb this menace, hence the birth of iReporter. 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 needs g…

Notifications You must be signed in to change notification settings

nadralia/iReporter_ch3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status Maintainability

iReporter_ch3

Corruption is a huge bane to Africa’s development. African countries must develop novel and localised solutions that will curb this menace, hence the birth of iReporter. 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 needs government intervention.

Features

  • Create (sign up) user account
  • Sign in (login) to the app
  • Create a incident record
  • Get all incident records
  • Get a specific incident record
  • Edit a specific incident record.
  • Delete an incident record
  • 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).

API Endpoints

Methods EndPoint Functionality Access
POST /api/v2/auth/signup Sign up a user PUBLIC
POST /api/v2/auth/login Login a user PUBLIC
POST /api/v2/incidents Create an incident record a user PRIVATE
GET /api/v2/incidents Fetch all incident records. PRIVATE
GET /api/v2/incidents/incident_id Fetch a specific incident -record PRIVATE
PATCH /api/v2/incidents/incident_id/location Edit the location of a specific incident record PRIVATE
PATCH /api/v2/incidents/incident_id/comment Edit the comment of a specific incident record PRIVATE
DELETE /api/v2/incidents/incident_id Delete a specific red flag record. PRIVATE

Technologies used to build the application

  • Python3 - A programming language that lets us work more quickly.
  • Flask - A microframework for Python based on Werkzeug, Jinja 2 and good intentions.
  • Virtualenv - A tool to create an isolated virtual environment.
  • Git - Version Control System for tracking your changes.

Installation

Create a new directory and initialize git in it. Clone this repository by running

git clone https://github.com/nadralia/iReporter_ch3

Create a virtual environment. For example, with virtualenv, create a virtual environment named venv using

virtualenv venv

Activate the virtual environment

cd venv/scripts/activate

Install the dependencies in the requirements.txt file using pip

pip install -r requirements.txt

Start the application by running

python run.py

How to run tests

Enter the command below in the terminal to run the tests with coverage using pytest

  python -m pytest tests/

.env Settings

  export "APP_SETTINGS"=""
  export "DATABASE_NAME"=""
  export "DATABASE_USER"=""
  export "DATABASE_PASSWORD"=""
  export "DATABASE_HOST"=""
  export "DATABASE_PORT"=""

run your .env file on terminal

  source .env

Endpoint Examples

Signup a user

{
    "email": "adminireporter@gmail.com",
    "firstname": "Admin",
    "gender": "Male",
    "is_admin": "True",
    "lastname": "ireporter",
    "othernames": "",
    "password": "nadra2526#A",
    "phonenumber": "+256779004531",
    "username": "admin007"
}

Login a user

{
    "password": "nadra2526#A",
    "username": "admin007"
}

Post a redflag incident : api/v2/incidents

{
   "incident_type": "red-flag",
   "latitude": "6.5951139",
   "longitude": "3.3429975",
   "images": "rigg.jpg",
   "videos": "goodvideo.mp4",
   "comment": "Extortion at the NIRA"
}

Link to iReporter on Heroku

https://dbireporter.herokuapp.com/

Author

Adralia Nelson

Acknowledgements

Big thanks to LFA's and fellow colleagues at Andela for reviewing the project and the guiding on the basic principles.

About

Corruption is a huge bane to Africa’s development. African countries must develop novel and localised solutions that will curb this menace, hence the birth of iReporter. 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 needs g…

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published