Giter VIP home page Giter VIP logo

incidentreport's Introduction

Incident Report

Fetch Emergency incidents with additional data.

Table of Contents:

TODOs {#todos}

  • Download and Setup environment
  • Create Weather API Interface
  • Create Incident Report Interface
  • Create Endpoints for API requests
  • Document installation process
  • Create Integration tests for API
  • Security considerations
  • Data storage considerations
  • Possible Improvements

Setup for Ubuntu {#setup-for-ubuntu}

These are the installation instructions for Ubuntu 20.04 but it could work for other distributions either way Python3.6+ is required.

There are two ways to install and run the application. One is to install and run with a virtual environment like pipenv (Recommended). Option Two, is to install everything with pip and then run everything from the command line normally.

Prerequiste:

Installing:

With Pipenv:

  1. In ./Pipfile, under the [requires] header, check to make sure that the python_version is the same as your local version (your local python version: python3 --version).

  2. If the python_version is not the same and you need to change it then that is fine but you also should delete ./Pipfile.lock, also if there are any issues with the Lock file it might be usefull to delete the lock then try installing again.

  3. Then simply run pipenv install.

Without Pipenv:

  1. Simply install with pip install -r requirements.txt.

Running:

  1. If you have pipenv then you can start your shell with pipenv shell, also if you have pipenv then you can run the commands normally but just pre-append pipenv run (i.e. pipenv run uvicorn main:app).

  2. Make sure that mongodb is running locally and if you want to setup the DB with some data you can use the init_db.py tool. By default it loads data from ./tests/data into the DB. But you can easily add more json reports by running python3 init_db.py -f /path/to/report.json.

  3. To start the API simply run uvicorn main:app. (you can learn more about uvicorn and FastAPI from the "Additional Dependencies information" below)

  4. Next you can make requests to the localhost server: http://127.0.0.1:8000/

  5. And you can view the endpoint documentation (SwaggerUI) here: http://127.0.0.1:8000/docs or the ReDoc version: http://127.0.0.1:8000/redoc

Additional Dependencies information:

Running Integration Tests {#running-integration-tests}

To run the integration tests simply run pytest from the main directory (or if you have pipenv then run pipenv run pytest).

Improvements {#improvements}

Here are some things I would have done if I had more time:

  • Clean up the code base and add more descriptions for each method/class.
  • Expand and improve the Data validation models. Both Query and Field have description attributes, I probably would have started there.
  • I would improve my data storage and data model. I think I would store the weather data with the incident reports or if I was using SQL I would've created a table for the weather objects that join to the incident reports.
  • Of course I would have expanded on my tests and I would've added unit test sweeps as well.
  • Finally I would have added security features like Authorization Tokens.

Summary {#summary}

Time spent:

  • 8am - 9am: researching libraries and reading documentation.
  • 9am - 10am: Installing and setting up the env. Implenting the weather service. Adding documentation.
  • 10am - 12pm: Setting up a database and getting the Incident service to query the DB for resutls.
  • 2pm - 4pm: Connecting the API components with the Weather and incident services.
  • 7pm - 8pm: Integration tests and any remaining docs.

incidentreport's People

Contributors

deadmau6 avatar

Watchers

 avatar  avatar

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.