Skip to content

jonamsalem/NYC-Mortality-Api

Repository files navigation

NYC Mortality API

Overview

The NYC Mortality API is a web service designed to analyze and provide insights into mortality rates in New York City. This project leverages PostgreSQL as the database to store mortality data, Python (with Flask) as the backend framework, and React for the frontend user interface (TODO).

Table of Contents

Features

  • Retrieve the version of the PostgreSQL database.
  • Analyze mortality data based on various parameters (e.g., demographics, causes of death).
  • Flexible and reusable query execution with connection pooling for efficient database access.

Technologies

  • Backend: Python, Flask
  • Database: PostgreSQL
  • Frontend: React
  • Database Driver: psycopg2 for PostgreSQL interaction

Setup

  1. Clone the repository:

    git clone https://github.com/your-username/NYC-Mortality-Api.git
    cd NYC-Mortality-Api

    Install dependencies:

     pip install -r requirements.txt

    Create a .env file in the root directory and populate with secrets. DO NOT store secrets in example.env.

  2. DO NOT write code in main

code in a different branch that is not main example git checkout -b"update-readme" on terminal

  1. Always pull main before creating new code example git pull origin main on terminal

  2. Unzip the random_search_model.pkl.zip file

  3. Run server

    python3 app.py
  4. Before writing code:

    git pull origin main
  5. When done writing code:

    git add . 
    git commit -m "message"
    git push origin main

To run the prediction endpoint follow this format:

curl -X POST http://localhost:5000/predict -H "Content-Type: application/json" -d '{
  "Sex": ["Male"],
  "Race Ethnicity": ["Hispanic"],
  "Death Rate": [15.4],
  "Age Adjusted Death Rate": [22.8]
}'
{
  "predicted_leading_cause": "Meningitis (G00, G03)"
}


Contributors

Ruby Ssk

Ezeddin Fadel

Jonathan Amsalem

About

PostgreSQL + python server to analyze nyc mortality rates.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages