Coder Social home page Coder Social logo

earthquake_final's Introduction

Storing Earthquake Events into DynamoDB with http API access

  • Uploading and storing the United States Geological Survey's Earthquake data to the could with http API access.

Presentation

-> Click here for Video Presentation <-

The Goal and Plan

  • In this project I wanted to ingest JSON data into cloud storage using AWS dynamodb.
  • I created an HTTP API to access the data.
  • I created a diagram of the pipeline to get a plan of how to build it and what tools I would need to incorporate.

alt text

The Data Set

  • The web data comes from USGS EARTHQUAKE API.
  • This powerful API allows users to query the Earthquake database in different ways, including by date.
  • The data utilized was generated by querying all earthquakes from 2020-01-01 to 2020-01-02, this returned 610 events.
  • The following attributes were selected for ingestion into the database: id, magnitude, focaldepth, latitude, longitude, time, update_time

Used Tools

  • Python, AWS CLI, DynamoBD, Lambda, API HTTP Gateway

Data Ingestion

  • After setting my request parameters to the dates I wanted, I downloaded the raw json file to my computer.
  • The JSON data was read using the JSON library and the payload was extracted into variables.
  • A connection to the DynamoDB database was made via the boto3 library and the AWS command line interface.

Storage

  • Finally, within the python code the put.item() method populated the items stored within the Earthquake Table.

alt text

Connect to Database

  • An HTTP API was chosen due to it's flexibility to be accessed by different consumers, platforms, and technologies
  • I created an HTTP API, routes, integrate the routes with the lambda function.
  • Testing the API in Postman shows GET method working with the Table.

alt text

Challenges

  • Getting boto3 to ingest float data types was a struggle. I pass the json.dumps method requires a parse as decimal command.
  • Accessing JSON nested data structures using python loops.

Conclusion

  • This pipeline project demonstrates a way to store JSON data into a Dynamo Database and attached an HTTP API for consumption.

Helpful Links

Follow Me On

earthquake_final's People

Contributors

anelson82 avatar

Stargazers

Jirasak Pakdeeto avatar  avatar

Watchers

 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.