# anddy-96/upi-scrapping architecture

> Architecture diagram of the GitHub repository anddy-96/upi-scrapping, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anddy-96/upi-scrapping
- Repository: https://github.com/anddy-96/upi-scrapping

## Overview

1. **Repository shape**
   - This is a very small Java/Maven project, centered around a single application class: `upcheck/src/main/java/TimeSeriesChart.java`.
   - There is no evidence of separate backend, database, or service layers; the architecture is essentially a **single-process data collection + visualization tool**.

2. **Primary purpose**
   - The app pulls the **latest UPI transaction-app rankings** from NPCI and shows the **top 5 apps over the last 5 months**.
   - The output appears to be a **time-series chart** comparing the latest month against prior months.

3. **External data boundary**
   - The only clear external dependency in the architecture is the NPCI statistics page:
     - `https://www.npci.org.in/what-we-do/upi/upi-ecosystem-statistics`
   - This is the system’s upstream data source and the main point where network access and HTML structure dependency matter.

4. **Data acquisition subsystem**
   - The app performs **web scraping** against the NPCI page rather than consuming an official API.
   - That means the ingestion layer is tightly coupled to the page’s HTML layout and whatever tables/cards NPCI publishes for UPI statistics.

5. **Transformation / selection logic**
   - The fetched statistics are reduced to a narrow dataset:
     - only the **top 5 UPI apps**
     - only the **last 5 months**
   - The README explicitly says the latest month is displayed alongside the previous month values, so the pipeline likely normalizes month-by-month ranking data into a chart-friendly structure.

6. **Visualization subsystem**
   - `TimeSeriesChart.java` suggests the core output is a **chart rendering component**, not just console output.
   - The chart is the presentation boundary: it consumes the scraped/transformed monthly series and renders them for the user.

7. **Execution model**
   - The project is intended to be run directly after resolving Maven dependencies.
   - This implies a **local desktop/CLI-style Java application** rather than a deployed web service.

8. **Build and packaging**
   - `pom.xml` indicates Maven is used for dependency management and build orchestration.
   - The `target/classes` directory confirms a standard Maven compile output, reinforcing that the project is packaged and executed as a conventional Java app.

9. **Likely internal flow**
   - The operational flow is:
     - fetch NPCI statistics page
     - extract monthly top-app values
     - keep the last five months
     - generate a time-series chart for the top 5 apps
   - That flow is linear, with no obvious asynchronous processing, persistence, or multi-stage backend pipeline.

10. **Architecture boundaries to draw**
   - One boundary is **local app vs. remote NPCI website**.
   - Another is **data extraction vs. chart presentation** inside the app.
   - There is no visible persistence boundary, no API boundary, and no user-authentication boundary.

11. **Practical implication**
   - The system is small but somewhat brittle in the usual way web scrapers are: changes to NPCI’s page structure could break the data extraction layer even if the charting code remains intact.

Main entry points: [`upcheck/src/main/java/TimeSeriesChart.java`](https://github.com/anddy-96/upi-scrapping/blob/main/upcheck/src/main/java/TimeSeriesChart.java) (Chart app), [`upcheck/pom.xml`](https://github.com/anddy-96/upi-scrapping/blob/main/upcheck/pom.xml) (Maven build)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Local app"]
  node_pom["Maven build<br/>build config<br/>[pom.xml]"]
  node_chart["Chart app<br/>Java entrypoint"]
  node_fetch["Page fetch<br/>scraper"]
  node_parse["Extract stats<br/>HTML parser"]
  node_select["Top 5 series<br/>transform"]
  node_series["Monthly data<br/>in-memory dataset"]
  node_render["Time-series chart<br/>visualization"]
end

subgraph group_external["External source"]
  node_npci["NPCI stats page<br/>external website"]
end

node_pom -->|"builds"| node_chart
node_chart -->|"starts"| node_fetch
node_fetch -->|"requests"| node_npci
node_npci -->|"supplies HTML"| node_parse
node_parse -->|"reduces"| node_select
node_select -->|"materializes"| node_series
node_series -->|"feeds"| node_render
node_chart -->|"drives"| node_render

click node_pom "https://github.com/anddy-96/upi-scrapping/blob/main/upcheck/pom.xml"
click node_chart "https://github.com/anddy-96/upi-scrapping/blob/main/upcheck/src/main/java/TimeSeriesChart.java"
click node_fetch "https://github.com/anddy-96/upi-scrapping/blob/main/upcheck/src/main/java/TimeSeriesChart.java"
click node_parse "https://github.com/anddy-96/upi-scrapping/blob/main/upcheck/src/main/java/TimeSeriesChart.java"
click node_select "https://github.com/anddy-96/upi-scrapping/blob/main/upcheck/src/main/java/TimeSeriesChart.java"
click node_series "https://github.com/anddy-96/upi-scrapping/blob/main/upcheck/src/main/java/TimeSeriesChart.java"
click node_render "https://github.com/anddy-96/upi-scrapping/blob/main/upcheck/src/main/java/TimeSeriesChart.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_pom,node_chart,node_fetch,node_parse,node_select,node_series,node_render toneBlue
class node_npci toneAmber
```

## Components

### Local app

Single-process Java application that fetches and charts UPI rankings

- [Maven build](https://github.com/anddy-96/upi-scrapping/blob/main/upcheck/pom.xml): build config · Dependency and build orchestration for the Java app · `upcheck/pom.xml`
- [Chart app](https://github.com/anddy-96/upi-scrapping/blob/main/upcheck/src/main/java/TimeSeriesChart.java): Java entrypoint · Main application class and execution flow · `upcheck/src/main/java/TimeSeriesChart.java`
- [Page fetch](https://github.com/anddy-96/upi-scrapping/blob/main/upcheck/src/main/java/TimeSeriesChart.java): scraper · Loads the NPCI statistics page over the network · `upcheck/src/main/java/TimeSeriesChart.java`
- [Extract stats](https://github.com/anddy-96/upi-scrapping/blob/main/upcheck/src/main/java/TimeSeriesChart.java): HTML parser · Reads the page structure and extracts ranking data · `upcheck/src/main/java/TimeSeriesChart.java`
- [Top 5 series](https://github.com/anddy-96/upi-scrapping/blob/main/upcheck/src/main/java/TimeSeriesChart.java): transform · Keeps the top 5 apps across the last 5 months · `upcheck/src/main/java/TimeSeriesChart.java`
- [Monthly data](https://github.com/anddy-96/upi-scrapping/blob/main/upcheck/src/main/java/TimeSeriesChart.java): in-memory dataset · Chart-ready month-by-month ranking values · `upcheck/src/main/java/TimeSeriesChart.java`
- [Time-series chart](https://github.com/anddy-96/upi-scrapping/blob/main/upcheck/src/main/java/TimeSeriesChart.java): visualization · Renders the final comparison chart for the user · `upcheck/src/main/java/TimeSeriesChart.java`

### External source

Upstream NPCI statistics page scraped by the app

- **NPCI stats page**: external website · Source of UPI ecosystem statistics and app rankings

## Connections

- Maven build → Chart app: builds · Maven compiles the application
- Chart app → Page fetch: starts · Main flow initiates data acquisition
- Page fetch → NPCI stats page: requests · Scrapes the public NPCI statistics page
- NPCI stats page → Extract stats: supplies HTML · The page structure is parsed for ranking data
- Extract stats → Top 5 series: reduces · Extracted statistics are narrowed to the relevant months and apps
- Top 5 series → Monthly data: materializes · Transforms the filtered results into chart-ready series
- Monthly data → Time-series chart: feeds · The dataset is passed to the visualization layer
- Chart app → Time-series chart: drives · Application control flow culminates in chart rendering
