GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - RaajveerX/NOAA_Weather_Data_REST

BranchesTags
Open more actions menu

Latest commit

 

History

16 Commits
16 Commits

Folders and files

NameName
Last commit message
Last commit date
frontend
frontend
 
 
.dockerignore
.dockerignore
 
 
.gitignore
.gitignore
 
 
Dockerfile
Dockerfile
 
 
README.md
README.md
 
 
database.js
database.js
 
 
docker-compose.yaml
docker-compose.yaml
 
 
format.txt
format.txt
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
server.js
server.js
 
 
test.rest
test.rest
 
 

Repository files navigation

REST Wrapper over NOAA Weather Data

Prerequisites

  • Docker, Docker Compose, Git

Quick Start

Startup Time = ~5 min due to downloading the .csv file from source, loading data into postgres

  1. Clone the repository
git clone https://github.com/RaajveerX/NOAA_Weather_Data_REST.git
  1. Start the app using Docker Compose:
docker-compose up --build
  1. Access the application:
  • Frontend: Open your browser and navigate to http://localhost:8080
  • API: The backend API is available at http://localhost:1300/station/<station_id>

Project Structure

  • ./frontend: Contains the front-end files
  • server.js: Main Express server file
  • database.js: Database connection and data loading
  • docker-compose.yaml: Docker configuration for the three services, frontend, backend, and database
  • Dockerfile: Dockerfile to set up dependencies, env, etc

API Endpoints

  • GET /: For checking server health
  • GET /station/<station_id>: Get weather records for a specific station

Example Test Endpoints

http://localhost:1300/station/AE000041196
http://localhost:1300/station/invalid_id
http://localhost:1300/station/AEM00041217

System Design

Tech Stack

  • Backend: Node.js + Express.js
  • Database: PostgreSQL
  • Front-end: Vanilla JS + Tailwind CSS

Data Loading

  • The Dockerfile is configured to download the CSV file from the NOAA URL and then unzip it. This takes some time depending on the internet speed.
  • Since the CSV file is pretty large, I wanted a balance between efficient storage and fast queries. I looked into options like a Map, DynamoDB, and MongoDB, but ended up choosing PostgreSQL
  • To avoid running into memory issues and prevent heap memory overload, I process the CSV file in chunks of 1 million lines and stream it into PostgreSQL using COPY instead of INSERT statements
  • There’s a small memory tradeoff since the chunks are stored briefly before being processed using Node.js streams

Optimizing The Queries

  • After loading the data, I create an index on the station_id column in PostgreSQL, sorting the records in descending order of date
  • This allows queries in O(LogN) time

Frontend

  • Since the user only needs to enter a station_id and retrieve data, I kept it simple with Vanilla JS. Later, I added Tailwind CSS to make it look better
  • Served it using nginx since I have used it before to serve static files in an easy and efficient way

NBMetadataCache

About

No description, website, or topics provided.

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.