Skip to content

epitrac/epitrac_be

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

137 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EpiTrac API

Covid virus

Table of Contents

Project Overview

EpiTrac is an interactive public health application that enables users to view weekly notifiable disease counts by state as well as relevant articles and information for each disease.

This repo is the Back End part of a project built by students at Turing School of Software and Design. You can find the Front End repo HERE.

Learning Goals

Project Spec

This project's goal is to create a successful web application from a student-led project idea, focusing on Service-Oriented Architecture with a separate front and back end. The back-end handles the project's API consumption and acts as the interface to the project's database.

Built With

  • Rails 5.2.8
  • Ruby 2.7.4

Setup

  1. Clone the repository
  2. cd into the root directory
  3. Install gem packages: bundle install
  4. Setup the database: rails db:{drop,create,migrate}
  5. Import Disease Info into diseases table: rake csv_load:diseases
  6. Run rails c and then Disease.count. You should have 109 diseases.
  7. You may run the RSpec test suite locally with bundle exec rspec

Endpoints

Available endpoints:

Run in Postman

Back End Server: https://epitrac-be.herokuapp.com/

Disease Cases

Get the Latest Week Disease Cases by State

Returns a list of diseases in that state for the most recent MMWR week recorded in the NNDSS Weekly Dataset. Data Sourced from the NNDSS Weekly Data API

Request:

GET /api/v1/disease_cases?state=#{state_name}

Example: Get Disease Cases in Georgia

JSON Response Example:

{
    "data": [
        {
            "id": "20225200032",
            "type": "disease_case",
            "attributes": {
                "state": "GEORGIA",
                "year": "2022",
                "current_week": 52,
                "disease": "Anthrax",
                "cumulative_current": 0,
                "cumulative_last": 0,
                "coordinates": [
                    -84.39111,
                    33.74831
                ],
                "id": "20225200032",
                "current_week_cases": 0
              }
        },
        {
            "id": "20225200102",
            "type": "disease_case",
            "attributes": {
                "state": "GEORGIA",
                "year": "2022",
                "current_week": 52,
                "disease": "Arboviral diseases, Chikungunya virus disease",
                "cumulative_current": 0,
                "cumulative_last": 0,
                "coordinates": [
                    -84.39111,
                    33.74831
                ],
                "id": "20225200102",
                "current_week_cases": 0
              }
        },
        {...},
        {...},
        ]
}
Get All Disease Cases for Current Week

Returns a list of diseases in all states for the most recent MMWR week recorded in the NNDSS Weekly Dataset.

Data Sourced from the NNDSS Weekly Data API.

Request:

GET /api/v1/disease_cases

Example: Get All Disease Cases For Latest Week

JSON Response Example:

{
    "data": [
        {
            "id": "20225200003",
            "type": "disease_case",
            "attributes": {
                "state": "CONNECTICUT",
                "year": "2022",
                "current_week": 52,
                "disease": "Anthrax",
                "cumulative_current": 0,
                "cumulative_last": 0,
                "coordinates": [
                    -72.67399,
                    41.76376
                ],
                "id": "20225200003",
                "current_week_cases": 0
            }
        },
        {
            "id": "20225200004",
            "type": "disease_case",
            "attributes": {
                "state": "MAINE",
                "year": "2022",
                "current_week": 52,
                "disease": "Anthrax",
                "cumulative_current": 0,
                "cumulative_last": 0,
                "coordinates": [
                    -69.77631,
                    44.31804
                ],
                "id": "20225200004",
                "current_week_cases": 0
            }
        },
        {...},
        {...},
    ]
}

Articles

Get Articles for a Disease

Returns a list of articles related to that disease.

Data sourced from Science Clips.

Request:

GET /api/v1/articles?disease=#{disease}

Example: Get Articles Related to Anthrax

JSON Response Example:

{
 "data": [
        {
            "id": "1076",
            "type": "article",
            "attributes": {
                "article_id": "1076",
                "author": "de Oliveira, F. F. M. M., S.;Gonti, S.;Brey, R. N.;Li, H.;Schiffer, J.;Casadevall, A.;Bann, J. G.",
                "title": "Binding of the von Willebrand factor a domain of capillary morphogenesis protein 2 to anthrax protective antigen vaccine reduces immunogenicity in mice",
                "year": "2020",
                "date": "15-01",
                "isbn_issn": "2379-5042",
                "keywords": "anthrax:antigen processing:immunization:protein stability",
                "abstract": "Protective antigen (PA) is a component of anthrax toxin ....",
                "url": "https://www.ncbi.nlm.nih.gov/pubmed/31941807",
                "doi": "10.1128/mSphere.00556-19"
            }
        },
        {
            "id": "1380",
            "type": "article",
            "attributes": {
                "article_id": "1380",
                "author": "Hupert, N. W., D.,  Cuomo, J.,  Hollingsworth, E.,  Neukermans, K.,  Xiong, W.,",
                "title": "Predicting hospital surge after a large-scale anthrax attack: a model-based analysis of CDC's cities readiness initiative prophylaxis recommendations",
                "year": "2009",
                "date": "Jul-Aug",
                "isbn_issn": "0272-989X (Print)",
                "keywords": null,
                "abstract": "BACKGROUND: A CRI-compliant prophylaxis...",
                "url": "http://mdm.sagepub.com/cgi/reprint/29/4/424",
                "doi": "10.1177/0272989X09341389"
            }      
        },
        {...},
        {...},
        ...
        ...
      ]
}
Save an Article for a User

Request:

POST /api/v1/user_articles?user_id=#{user_id}&article_id=#{article_id}

JSON Response Example:

{
 "data": {
        "id": "10",
        "type": "user_article",
        "attributes": {
            "user_id": 1,
            "article_id": 88
        }
    }
}
Delete a Saved Article for a User

Request:

DELETE /api/v1/user_articles/:id

JSON Response Example:

{
    "message": "The article was successfully deleted from your dashboard"
}
Get a Users Saved Articles

Request:

GET /api/v1/user_articles/?user_id=#{user_id}

JSON Response Example:

{
    "data": [
        {
            "id": "1",
            "type": "article",
            "attributes": {
                "article_id": "50",
                "author": "Johnson, T. L. G., C. B., Maes, S. E., Hojgaard, A., Fleshman, A., Boegler, K. A., Delory, M. J., Slater, K. S., Karpathy, S. E., Bjork, J. K., Neitzel, D. F., Schiffman, E. K., Eisen, R. J.,",
                "title": "Prevalence and distribution of seven human pathogens in host-seeking Ixodes scapularis (Acari: Ixodidae) nymphs in Minnesota, USA",
                "year": "2018",
                "date": "20-07",
                "isbn_issn": "1877-959x",
                "keywords": "Anaplasmosis:Babesiosis:Coinfection:Density of infected nymphs (DIN):Lyme disease:Nymphal infection prevalence (NIP)",
                "abstract": "In the north-central United States,...",
                "url": "https://www.ncbi.nlm.nih.gov/pubmed/30055987",
                "doi": "10.1016/j.ttbdis.2018.07.009"
            }
        },
        {...}
    ]
}


Disease Info

Get Information for all Diseases

Request:

GET /api/v1/disease_info

Example: Get information for all diseases

JSON Response Example:

{
    "data": [
        {
            "id": "1",
            "type": "disease_info",
            "attributes": {
                "disease": "Anthrax",
                "short_name": "Anthrax",
                "information": "Anthrax is a serious infectious disease...",
                "link": "https://www.cdc.gov/anthrax/"
            }
        },
        {
            "id": "2",
            "type": "disease_info",
            "attributes": {
                "disease": "Arboviral diseases, Chikungunya virus disease",
                "short_name": "Chikungunya",
                "information": "Chikungunya virus is spread to people...",
                "link": "https://www.cdc.gov/chikungunya/index.html"
            }
        },
        {....}
    ]
}
Get Information for One Disease

Request:

GET /api/v1/disease_info?disease=#{disease}

Example: Get Information for Anthrax

JSON Response Example:

{
    "data": [
        {
            "id": "1",
            "type": "disease_info",
            "attributes": {
                "disease": "Anthrax",
                "short_name": "Anthrax",
                "information": "Anthrax is a serious infectious disease...",
                "link": "https://www.cdc.gov/anthrax/"
            }
        }
    ]
}

Contributors

Shawn Lee Madeline Mauser Emily Port Darby Smith William Wang
GitHub
LinkedIn
GitHub
LinkedIn
GitHub
LinkedIn
GitHub
LinkedIn
GitHub
LinkedIn

Gems

Schema

Screen Shot 2023-01-11 at 10 08 15 PM

Known Issues/Future Goals

Future features could include:

  • Delete all articles endpoint

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors