How edictor96/tarangini-alerts works
Project type and purpose
• This is a small full-stack monolithic web application (“Taranगini — Disaster Alert Demo”).
• It ingests disaster-alert data by scraping an external source (INCOIS), stores it in a local JSON file (alerts.json), and serves a simple UI over HTTP using FastAPI with Jinja2 templates and static assets.
File structure
• Top-level
– main.py → entrypoint for FastAPI application (run via uvicorn)
– incois_scraper (1).py → standalone scraper script that fetches data from INCOIS and writes to alerts.json
– alerts.json → local data store for scraped alert records
– README.md → instructions to set up and run
– .gitignore → version-control ignores
• Folders
– templates/ → Jinja2 HTML views (index.html, db_view.html) and CSS file (styles.css)
– static/ → any other static assets (images, JS, extra CSS)
README for additional insights
• Confirms use of uvicorn and FastAPI (“python -m uvicorn main:app --reload”)
• No external database; uses a JSON file as data store
• Simplified demo, no cloud deployment files or containerization shown
a. Main components
• External Data Source (INCOIS API or website)
• Scraper Module (incois_scraper.py)
• Local Data Store (alerts.json)
• Backend Service (FastAPI app in main.py)
• Templating Engine (Jinja2)
• Static File Server (CSS under templates/ or static/)
• Web Client (Browser)
b. Relationships and data flows
1. Scheduler or manual trigger invokes the Scraper Module → fetches from INCOIS → writes to alerts.json
2. Web Client (Browser) → HTTP GET to Backend Service
3. Backend Service reads alerts.json → processes via Jinja2 → serves HTML + CSS
4. Web Client renders UI, user interacts → may trigger more API calls or page reloads
c. Architectural patterns / principles
– Separation of concerns: scraping logic is decoupled from request handling
– Single-process monolith; could evolve into microservices if scaled
– Template-based rendering for simplicity (no SPA framework)
d. Key technologies/frameworks
– Python 3, FastAPI, Uvicorn
– Jinja2 templating
– Simple file-based “database” (alerts.json)
– Optional scheduler (cron, APScheduler) for the scraper
Detailed yet simple breakdown
• Don’t over-fragment: two main subsystems (Data Ingestion vs Presentation) plus external source and client.
• Every Python script as a component only if it has an ongoing runtime role (main.py, scraper if scheduled).