Skip to content

REST API access to the Storm Prediction Center's Severe Weather Database tornado events

Notifications You must be signed in to change notification settings

ephcoding/tornado-api

Repository files navigation

readme title graphic
intro  |  license  |  features  |  how to use  |  contribute  |  connect

Version 1 of tornadoapi.com will provide RESTful access to statistical data for every tornado recorded since 1950. The Storm Prediction Center's Severe Weather Database Files serve as the foundation of the API.

The goal of this project is to make historical tornado data more accessible to severe wx fanatics and meteorology professionals alike. TornadoAPI.com will also serve as the visualization data source for my other project, tornadowarned.com.

Version 2 of the API will provide GraphQL access to the same set of data provided in the REST version.


readme license graphic
intro  |  license  |  features  |  how to use  |  contribute  |  connect

The MIT License (MIT)

Copyright © 2023 | Ephraim Smith

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

readme features graphic
intro  |  license  |  features  |  how to use  |  contribute  |  connect

RESTful Access to Historical U.S. Tornado Data

  • Severe Weather Tornado Data
  • Severe Weather Hail Data
  • Severe Weather Wind Data

API Documentation

  • comprehensive README.md
  • REST endpoints
  • GraphQL schemas

Coming Soon: GraphQL Access to Historical U.S. Tornado Data

readme how-to-use graphic
intro  |  license  |  features  |  how to use  |  contribute  |  connect

Install & Run Your Own Instance of the Tornado API

Clone The Repo

cd <parent-folder-path/>
git clone https://github.com/ephcoding/tornado-api.git

Install Project Dependencies

cd tornado-api
npm install

OR

yarn

Run Your New Project

npm run dev

OR

yarn  dev
Project Structure
tornado-api/....................root directory
  config/.......................database & deployment configs
  constants/....................manage project-wide variables here
  controllers/..................endpoint-handling logic
  data/.........................source and seed data files
  images/.......................graphic assets for README.md
  models/.......................database object definitions
  routes/.......................request routing
  utils/........................util functions for converting .csv files to .json files
  .gitignore....................don't expose those .env keys!
  package.json..................project dependencies
  README.md.....................you are here [X]
  yarn.lock.....................dependency lock file
Code Features

config/

  • config.env | you'll need to create your own config.env with the following:
MONGODB_URI=<your MongoDB remote url string>
MONGODB_LOCAL_URI=<your local MongoDB instance url string>
NODE_ENV=development
PORT=<port#>

middleware/

  • async-handler.js | async wrapper for controller functions. Eliminates the need for a try/catch block in every controller function.
  • error-handler.js | handles various potential Mongoose & server errors.
  • logging-handler.js | used to log incoming requests
  • query-builder.js | handles incoming requests that include query params and/or filters.

utils/

  • ErrorResponse | class for streamlining new Error instantiation
  • json-from-csv.seed.js | converts single_track_tornadoes.csv into single_track_tornadoes.json for seeding MongoDB

(root)/

  • seeder.js | seeds tornado data into MongoDB using single_track_tornadoes.json
Dependencies

Production

  • csvtojson | .csv parser that converts .csv to .json
  • dotenv | loads .env variables into process.env
  • express | Node.js web framework
  • mongodb | Node.js driver for MongoDB
  • mongoose | async MongoDB object modeler
  • morgan | Node.js HTTP request logging middleware

Development

  • nodemon | restarts Node.js apps when file changes are made
Scripts

"start" | sets NODE_ENV to "production" and starts server

"dev" | starts the development server using nodemon


readme contribute graphic
intro  |  license  |  features  |  how to use  |  contribute  |  connect

Issues:

issue submission process coming soon

Pull Requests:

PR submission process coming soon

readme connect graphic
intro  |  license  |  features  |  how to use  |  contribute  |  connect

headshot of Ephraim Smith
           

About

REST API access to the Storm Prediction Center's Severe Weather Database tornado events

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published