How wilson101xx/imd_deprevation works
Project Type & Purpose
• This is a lightweight single-page web application built with Streamlit (front end) and a small backend module in Python.
• It has no internal database; instead it retrieves data on demand from external REST APIs (IMD 2019 endpoints) and displays results to the user.
File-Structure Analysis
• Top level:
• src/imd_streamlit_app.py – Streamlit UI code
• src/imd_backend.py – Data-fetching & processing functions
• Dependencies are declared in requirements.txt (streamlit, requests, pandas).
• No build scripts or deployment manifests beyond the Streamlit runtime.
Key Architecture Insights from README
• Two-module separation: UI vs. business logic.
• External data source: indicies of Multiple Deprivation API v2019.
• Technology stack: Python 3.10+, Streamlit, REST calls, pandas for processing.
Main Components & Their Relationships
a. User’s Browser / Client
• Interacts via HTTP with the Streamlit server on localhost:8501.
b. Streamlit Server (imd_streamlit_app.py)
• Renders UI widgets (postcode input, tabs for stats & descriptions).
• Calls backend functions to fetch and process data.
c. Backend Module (imd_backend.py)
• Defines functions to build API URLs, make HTTP GET requests, parse JSON into pandas DataFrames.
• Contains any data‐validation or transformation logic.
d. External IMD REST APIs
• Two endpoints: deprivation stats lookup and metadata/descriptions.
e. (Optional) Python Runtime & Libraries
• The environment hosting both UI and backend.
Data flow:
[Browser] → HTTP Postcode input → [Streamlit App] → function call → [Backend] → HTTP request → [External API]
← JSON ← [Backend] processes → DataFrame ← [Streamlit App] displays → Browser
Architectural Patterns & Design Principles
• Separation of concerns: UI vs. data logic.
• Single process, synchronous RPC‐style calls (Streamlit handles request→response cycle).
• Modular code organization for maintainability and unit testing.