GithubHelp home page GithubHelp logo

simaob / posso-ir-api Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 3.0 20 MB

Allowing people to track the state of queues to supermarkets, pharmacies, and other places. To avoid crowds in a time where self-isolation is key. #stayhome!

Home Page: https://www.posso-ir.com

License: MIT License

Ruby 64.70% JavaScript 10.76% CSS 1.40% HTML 22.98% Shell 0.16%
covid-19

posso-ir-api's Introduction

Posso Ir? Logo

README - Posso Ir API Build Status

Intro

This tool is part of the Posso Ir? application. In this project we have the backoffice, data importing scripts and the API that powers the mobile applications.

Posso Ir? is an application that we started building when the Coronavirus Pandemic started hitting Portugal. The goal of the application is to rally the power of the people to report on the sizes of queues outsied of essential stores and services like Supermarkets, Pharmacies, Post Office, Banks, etc. In a time of recommended social distancing we want to help people decide when is the best time to buy the things they need, and where to go.

Everyone using the application is invited to contribute with info about the shops they visit. So that we can all help each other in this time of need and uncertainty.

Posso Ir? is part of the Tech4Covid19 Movement.

Contributing and Using this

If you would like to contribute or try to use this tool on your own country, feel free to reach out to us or to just clone the tool and have a go at it!

Dependencies

  • Ruby on Rails 6.0.2;
  • Ruby 2.6.3;
  • PostgreSQL 12;
  • PostGIS;
  • Node 10.15.2;

Setting up the project locally

  1. Clone the repository;
  2. Install dependencies: bundle install and yarn install
  3. Create and migrate database: rails db:create db:migrate
  4. Start the server with rails server
  5. Open your browser and visit http://localhost:3000 and ta-da!

Running the API

If you want to have a go at the API you'll need to setup a JWT_TOKEN in your .env file, check the .env.sample file;

We are using JWT for authentication on the API access. Tokenizing and decoding tokens is handled by app/services/jwt_service.rb.

Check the rails routes for the available API routes.

Importing Data

Data importing is a bit random at the time as we are using data from different providers in different formats, if you want some samples, message us! Otherwise just use the web interface to create your own stores.

Contributors

This tool is being built by the following people, who are part of the larger Posso Ir? team.

  • Bruno Pinto
  • Danton Dornellas
  • Francisca Fonseca
  • Hugo Dias
  • Joana Silva
  • João Crisóstomo
  • João Lobato
  • João Rodrigues
  • Luís Certo
  • Miguel Torres
  • Paulo Leite
  • Pedro Bertucci
  • Rafael Pires
  • Rodrigo Solís
  • Tiago Santos
  • Simão Belchior

posso-ir-api's People

Contributors

dependabot[bot] avatar hugopeixoto avatar santostiago avatar simaob avatar sorodrigo avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

posso-ir-api's Issues

Install redis

Install redis and make the jsonapi resources use it

Update sign up page to present the user with two possible routes

Currently when users access the sign up page they can only register as Collaborators. To improve store owner engagement we want to change this page to present two routes to the users: Collaborator and Store Owner;

We could do this by just enabling the role dropdown to be used by the users, but to I'm wondering if it might be nicer to have an initial step where we present the two possibilities to users and what each of them allows them to do, see the sketch with my idea.

Screenshot 2020-04-25 at 17 29 08

This adds an extra step, but it allows users to know what they are registering to do. And makes the register forms a little more simple as we don't need to check the value of the role chosen and change things based on that.

For the store owners form we need to allow the users to pick the stores they want to manage, as we already have, or in a nicer element, but we need to ensure that this connection is not active until we validate it. So we need to add a state to the user_stores table.

With this said, I'm now wondering if we really want to be validating all the store owners that might appear by us opening this up... thoughts?

List of (potential) tasks

  • Update register page to allow the two paths;
  • Move the current collaborator sign up to a separate route;
  • Create a new store owner sign up page with the possibility of selecting stores to manage;
  • Ensure that stores assigned to newly created store owners are not immediately available for them to report on, these need to be approved;
  • Email presence needs to be mandatory for Store Owners

Update home page to explain what is it about, how can people use the app and how they can contribute

Currently we have a beautiful welcome message and when logged in as an admin there is a dashboard with some metrics, we should update this to explain a bit what this site is about and how can people use the application and contribute to it:

  • as users of the app;
  • as collaborators for data additions and editing;
  • as store owners managing their stores and reporting on their stores queues;

There are no designs for this, so whoever picks it up can come up with something. We are using TwitterBootstrap so maybe using some cards and some images or just some cards with text might be good. Don't forget that it needs to be localised and we can get translations from some of the other volunteers.

As an API client I want to receive only the 100 closest stores from where I am located

Currently the /api/v1/stores?filter[location]=lat,long request will return up to 300 stores that are in a 5km radius from the provided lat long. This is a bit overwhelming for the applications to handle and probably to much for the users to parse through. So we are thinking of reducing the size of the response and return only the 100 stores that are close to the provided location.

If the user wants to see more locations they could move the map around and request for a slightly different location.

There are some potential concerns with discoverability, as in very populated places the users might not get the full list of stores. Some options are for the application to pass the store_type filter to the backend, for us to play a bit with the total number of stores returned, or in a future iteration paginate the results.

For now let's go with the backend change alone.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.