# dineshpiyasamara/financial-analysis---cse architecture

> Architecture diagram of the GitHub repository dineshpiyasamara/financial-analysis---cse, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dineshpiyasamara/financial-analysis---cse
- Repository: https://github.com/dineshpiyasamara/financial-analysis---cse

## Overview

This repository extracts financial figures from two companies’ PDF reports, writes structured CSV datasets, and presents those datasets through an interactive dashboard and profit forecasts. The main workflow is PDF extraction and pattern-based parsing into typed records, followed by CSV output; users then select a company in either Streamlit application. The graph also shows the shared data model and logging layer. Source excerpts support the shown calls and file reads; unsampled behavior is not inferred.

Main entry points: [`dataset_creation.py`](https://github.com/dineshpiyasamara/financial-analysis---cse/blob/master/dataset_creation.py) (PDF extraction and parsing), [`dashboard_visualization.py`](https://github.com/dineshpiyasamara/financial-analysis---cse/blob/master/dashboard_visualization.py) (Financial dashboard), [`profit_forecasting.py`](https://github.com/dineshpiyasamara/financial-analysis---cse/blob/master/profit_forecasting.py) (Profit forecasting), [`logger.py`](https://github.com/dineshpiyasamara/financial-analysis---cse/blob/master/logger.py) (Logging)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Report ingestion"]
  node_dipped_pdfs["Dipped PDFs"]
  node_rp_pdfs["Richard Pieris PDFs"]
  node_ingestion["PDF extraction and parsing"]
end

subgraph group_shared["Shared parsing"]
  node_patterns["Financial patterns<br/>[patterns.py]"]
  node_records["Financial records<br/>[models.py]"]
  node_logging["Logging<br/>[logger.py]"]
end

subgraph group_data["Structured data"]
  node_dipped_csv["Dipped dataset"]
  node_rp_csv["Richard Pieris dataset"]
end

subgraph group_apps["Analysis applications"]
  node_dashboard["Financial dashboard"]
  node_forecast["Profit forecasting"]
end

node_user(("User"))

node_user -->|"runs scraper"| node_ingestion
node_dipped_pdfs -->|"extracts text"| node_ingestion
node_rp_pdfs -->|"extracts text"| node_ingestion
node_ingestion -->|"matches values"| node_patterns
node_ingestion -->|"creates records"| node_records
node_ingestion -->|"logs progress"| node_logging
node_ingestion -->|"writes dataset"| node_dipped_csv
node_ingestion -->|"writes dataset"| node_rp_csv
node_user -->|"opens dashboard"| node_dashboard
node_user -->|"runs forecast"| node_forecast
node_dashboard -->|"reads dataset"| node_dipped_csv
node_dashboard -->|"reads dataset"| node_rp_csv
node_forecast -->|"reads dataset"| node_dipped_csv
node_forecast -->|"reads dataset"| node_rp_csv
node_dashboard -->|"logs activity"| node_logging
node_forecast -->|"logs progress"| node_logging

click node_dipped_pdfs "https://github.com/dineshpiyasamara/financial-analysis---cse/tree/master/dipped_productions"
click node_rp_pdfs "https://github.com/dineshpiyasamara/financial-analysis---cse/tree/master/richard_pieris_exports"
click node_ingestion "https://github.com/dineshpiyasamara/financial-analysis---cse/blob/master/dataset_creation.py"
click node_patterns "https://github.com/dineshpiyasamara/financial-analysis---cse/blob/master/patterns.py"
click node_records "https://github.com/dineshpiyasamara/financial-analysis---cse/blob/master/models.py"
click node_logging "https://github.com/dineshpiyasamara/financial-analysis---cse/blob/master/logger.py"
click node_dipped_csv "https://github.com/dineshpiyasamara/financial-analysis---cse/blob/master/structured_data/dipped_productions.csv"
click node_rp_csv "https://github.com/dineshpiyasamara/financial-analysis---cse/blob/master/structured_data/richard_pieris_exports.csv"
click node_dashboard "https://github.com/dineshpiyasamara/financial-analysis---cse/blob/master/dashboard_visualization.py"
click node_forecast "https://github.com/dineshpiyasamara/financial-analysis---cse/blob/master/profit_forecasting.py"

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_dipped_pdfs,node_rp_pdfs,node_ingestion,node_user toneBlue
class node_patterns,node_records,node_logging toneAmber
class node_dipped_csv,node_rp_csv toneMint
class node_dashboard,node_forecast toneRose
```

## Components

### Report ingestion

- [Dipped PDFs](https://github.com/dineshpiyasamara/financial-analysis---cse/tree/master/dipped_productions): `dipped_productions`
- [Richard Pieris PDFs](https://github.com/dineshpiyasamara/financial-analysis---cse/tree/master/richard_pieris_exports): `richard_pieris_exports`
- [PDF extraction and parsing](https://github.com/dineshpiyasamara/financial-analysis---cse/blob/master/dataset_creation.py): `dataset_creation.py`

### Shared parsing

- [Financial patterns](https://github.com/dineshpiyasamara/financial-analysis---cse/blob/master/patterns.py): `patterns.py`
- [Financial records](https://github.com/dineshpiyasamara/financial-analysis---cse/blob/master/models.py): `models.py`
- [Logging](https://github.com/dineshpiyasamara/financial-analysis---cse/blob/master/logger.py): `logger.py`

### Structured data

- [Dipped dataset](https://github.com/dineshpiyasamara/financial-analysis---cse/blob/master/structured_data/dipped_productions.csv): `structured_data/dipped_productions.csv`
- [Richard Pieris dataset](https://github.com/dineshpiyasamara/financial-analysis---cse/blob/master/structured_data/richard_pieris_exports.csv): `structured_data/richard_pieris_exports.csv`

### Analysis applications

- [Financial dashboard](https://github.com/dineshpiyasamara/financial-analysis---cse/blob/master/dashboard_visualization.py): `dashboard_visualization.py`
- [Profit forecasting](https://github.com/dineshpiyasamara/financial-analysis---cse/blob/master/profit_forecasting.py): `profit_forecasting.py`

### Other components

- **User**

## Connections

- User → PDF extraction and parsing: runs scraper (evidence: `README.md`)
- Dipped PDFs → PDF extraction and parsing: extracts text (evidence: `dataset_creation.py`)
- Richard Pieris PDFs → PDF extraction and parsing: extracts text (evidence: `dataset_creation.py`)
- PDF extraction and parsing → Financial patterns: matches values (evidence: `dataset_creation.py`)
- PDF extraction and parsing → Financial records: creates records (evidence: `dataset_creation.py`)
- PDF extraction and parsing → Logging: logs progress (evidence: `dataset_creation.py`)
- PDF extraction and parsing → Dipped dataset: writes dataset (evidence: `dataset_creation.py`)
- PDF extraction and parsing → Richard Pieris dataset: writes dataset (evidence: `dataset_creation.py`)
- User → Financial dashboard: opens dashboard (evidence: `README.md`)
- User → Profit forecasting: runs forecast (evidence: `README.md`)
- Financial dashboard → Dipped dataset: reads dataset (evidence: `dashboard_visualization.py`)
- Financial dashboard → Richard Pieris dataset: reads dataset (evidence: `dashboard_visualization.py`)
- Profit forecasting → Dipped dataset: reads dataset (evidence: `profit_forecasting.py`)
- Profit forecasting → Richard Pieris dataset: reads dataset (evidence: `profit_forecasting.py`)
- Financial dashboard → Logging: logs activity (evidence: `dashboard_visualization.py`)
- Profit forecasting → Logging: logs progress (evidence: `profit_forecasting.py`)
