Monitorizare Vot is a mobile app for monitoring elections by authorized observers. They can use the app in order to offer a real-time snapshot on what is going on at polling stations and they can report on any noticeable irregularities.
The NGO-s with authorized observers for monitoring elections have real time access to the data the observers are transmitting therefore they can report on how voting is evolving and they can quickly signal to the authorities where issues need to be solved.
Moreover, where it is allowed, observers can also photograph and film specific situations and send the images to the NGO they belong to.
The app also has a web version, available for every citizen who wants to report on election irregularities. Monitorizare Vot was launched in 2016 and it has been used for the Romanian parliamentary elections so far, but it is available for further use, regardless of the type of elections or voting process.
Contributing | Built with | Repos and projects | Deployment | Feedback | License | About Code4Ro
This project is built by amazing volunteers and you can be one of them! Here's a list of ways in which you can contribute to this project.
Uses Laravel 5.2
Main packages:
- JWT-Auth - tymondesigns/jwt-auth
- Dingo API - dingo/api
- Laravel-CORS barryvdh/laravel-cors
- PHP 7+ (with mbstring, openSSL extensions);
- Apache or Nginx (mod_rewrite required);
- MySQL;
Related projects:
- client app - https://github.com/code4romania/monitorizare-vot-votanti-client/
- admin app - https://github.com/code4romania/monitorizare-vot-votanti-admin
Other MV related repos:
- https://github.com/code4romania/monitorizare-vot-admin
- https://github.com/code4romania/monitorizare-vot-ong
- https://github.com/code4romania/monitorizare-vot
- https://github.com/code4romania/monitorizare-vot-android
- https://github.com/code4romania/monitorizare-vot-ios
- https://github.com/code4romania/monitorizare-vot-docs
In /tools/docker you can find a docker compose file that starts a php server with apache, a mysql server and a phpmyadmin instance. You will need to have docker and docker-compose(https://docs.docker.com/compose/) installed.
To start the services, go to the tools/docker folder and run:
docker-compose up -d
- Install prerequisites
composer install
- Configurations
Initial .env
setup
cp .env.docker .env
Add new local keys
php artisan key:generate //Not sure if really neccesary
php artisan jwt:generate
Run DB scrips
php artisan migrate --seed
- Run the local server with
php artisan serve
-
Test your storage folders structure
Sometimes these folders need to be created manually if the user doesn't have the rights to do so:
- /storage/framework/cache
- /storage/framework/sessions
- /storage/framework/views
- /storage/logs
Access http://localhost:8000 or http://localhost:8000/api/check in the browser to test the project. For documentation you can access http://localhost:8000/api/documentation
- (Optional) Swagger
To generate the swagger files
php artisan l5-swagger:publish
php artisan l5-swagger:generate
Once the files are generated you can access the swagger documentation at: http://localhost:8000/api/documentation
Once everything is built and started you can access the webservice at http://localhost:3200 and the phpmyadmin at http://localhost:3201 . If you are running Linux then you can use the direct IPs as well ( this does not work for Mac or Windows ).
To list the container do:
docker ps
The containers can be accessed by:
docker exec -it <container_name> bash
You can run composer and php commands from inside the container.
To add special configs to the PHP ini inside the container you can modify the config file.
- Controllers in /app/Api/V1/Controllers
- Routing in /app/Http/api_routes.php
- See Laravel and Dingo API documentation for more.
- Also: https://www.sitepoint.com/how-to-build-an-api-only-jwt-powered-laravel-app/
- login();
- signup();
- recovery();
- reset();
You will need:
- login: just email and password;
- signup: whatever you like: you can specify it in the config file;
- recovery: just the user email address;
- reset: token, email, password and password confirmation;
-
GET /api/incidents ( get last 20 incidents )
-
GET /api/incidents?limit=100 (Get more incidents)
-
_GET /api/incidents?limit=10&page=3+ (limit parameter is optional, will default to 20)
-
GET /api/incidents?status[]=Pending (filter by state)
-
GET /api/incidents?status[]=Pending&status[]=Rejected (get pending and rejected)
-
POST /api/incidents (Create incident)
-
PUT /api/incidents/5/approve (Approve incident - ADMIN)
-
PUT /api/incidents/5/reject (Reject incident - ADMIN)
-
DELETE /api/incidents/5 (Delete incident - ADMIN)
You can specify your routes in the api_routes.php
file, that will be automatically loaded. In this file you will find many examples of routes.
Every time you create a new project starting from this repository, the php artisan jwt:generate command will be executed.
As I already told before, this boilerplate is based on dingo/api and tymondesigns/jwt-auth packages. So, you can find many informations about configuration here and here.
However, there are some extra options that I placed in a config/boilerplate.php file.
- signup_fields: you can use this option to specify what fields you want to use to create your user;
- signup_fields_rules: you can use this option to specify the rules you want to use for the validator instance in the signup method;
- signup_token_release: if "true", an access token will be released from the signup endpoint if everything goes well. Otherwise, you will just get a 201 Created response;
- reset_token_release: if "true", an access token will be released from the signup endpoint if everything goes well. Otherwise, you will just get a 200 response;
- recovery_email_subject: here you can specify the subject for your recovery data email;
You can create endpoints in the same way you could to with using the single dingo/api package. You can read its documentation for details.
After all, that's just a boilerplate! :)
If you want to enable CORS for a specific route or routes group, you just have to use the cors middleware on them.
Thanks to the barryvdh/laravel-cors package, you can handle CORS easily. Just check the docs at this page for more info.
- Request a new feature on GitHub.
- Vote for popular feature requests.
- File a bug in GitHub Issues.
- Email us with other feedback contact@code4.ro
This project is licensed under the MPL 2.0 License - see the LICENSE file for details
Started in 2016, Code for Romania is a civic tech NGO, official member of the Code for All network. We have a community of over 500 volunteers (developers, ux/ui, communications, data scientists, graphic designers, devops, it security and more) who work pro-bono for developing digital solutions to solve social problems. #techforsocialgood. If you want to learn more details about our projects visit our site or if you want to talk to one of our staff members, please e-mail us at contact@code4.ro.
Last, but not least, we rely on donations to ensure the infrastructure, logistics and management of our community that is widely spread across 11 timezones, coding for social change to make Romania and the world a better place. If you want to support us, you can do it here.