# ashishallu/pharma-sales-market-access-dashboard architecture

> Architecture diagram of the GitHub repository ashishallu/pharma-sales-market-access-dashboard, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ashishallu/pharma-sales-market-access-dashboard
- Repository: https://github.com/ashishallu/pharma-sales-market-access-dashboard

## Overview

This repository is a Medicare Part D analytics product with two user-facing paths: an interactive Streamlit dashboard and a multi-sheet Excel workbook for Power BI. The documented batch path downloads CMS data, cleans and aggregates it, then exports workbook tables; the app also supports demo data and inline CSV uploads. The dashboard covers KPIs, specialty, geographic, and prescriber analysis, while Power BI adds category, drug, and time-oriented views. Some modules were only partially excerpted, so edges for those flows rely on README statements rather than unsampled implementation details.

Main entry points: [`app.py`](https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/app.py) (Year and state filters), [`download_data.py`](https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/download_data.py) (CMS downloader), [`preprocess.py`](https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/preprocess.py) (Clean and enrich), [`export_powerbi.py`](https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/export_powerbi.py) (Workbook exporter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data acquisition"]
  node_downloader["CMS downloader<br/>[download_data.py]"]
  node_rawcsv[("Raw annual CSVs")]
end

subgraph group_processing["Data preparation"]
  node_cleaning["Clean and enrich<br/>[preprocess.py]"]
  node_aggregates[("Analytical tables<br/>[preprocess.py]")]
end

subgraph group_dashboard["Streamlit analytics"]
  node_upload["CSV upload pipeline<br/>[app.py]"]
  node_demo["Demo baseline<br/>[app.py]"]
  node_filters["Year and state filters<br/>[app.py]"]
  node_kpis["KPI summary<br/>[app.py]"]
  node_specialty["Specialty profiles<br/>[app.py]"]
  node_geography["Geographic analysis<br/>[app.py]"]
  node_prescriber["Prescriber analysis<br/>[app.py]"]
end

subgraph group_reporting["Power BI reporting"]
  node_exporter["Workbook exporter<br/>[export_powerbi.py]"]
  node_workbook["Power BI workbook<br/>[PartD_PowerBI.xlsx]"]
  node_powerbi_views["Power BI report views<br/>[export_powerbi.py]"]
end

node_analyst(("Analyst"))
node_cms[("CMS data")]
node_powerbi(("Power BI analyst"))

node_cms -->|"provides data"| node_downloader
node_downloader -->|"saves CSVs"| node_rawcsv
node_rawcsv -->|"loads yearly data"| node_cleaning
node_cleaning -->|"writes summaries"| node_aggregates
node_analyst -->|"uploads CSV"| node_upload
node_upload -->|"prepares app data"| node_filters
node_demo -->|"supplies baseline"| node_filters
node_analyst -->|"selects scope"| node_filters
node_filters -->|"summarizes"| node_kpis
node_filters -->|"groups specialty spend"| node_specialty
node_filters -->|"groups state spend"| node_geography
node_filters -->|"compares providers"| node_prescriber
node_aggregates -->|"reads processed tables"| node_exporter
node_exporter -->|"writes sheets"| node_workbook
node_workbook -->|"imports workbook"| node_powerbi
node_powerbi -->|"explores report"| node_powerbi_views

click node_downloader "https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/download_data.py"
click node_cleaning "https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/preprocess.py"
click node_aggregates "https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/preprocess.py"
click node_upload "https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/app.py"
click node_demo "https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/app.py"
click node_filters "https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/app.py"
click node_kpis "https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/app.py"
click node_specialty "https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/app.py"
click node_geography "https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/app.py"
click node_prescriber "https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/app.py"
click node_exporter "https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/export_powerbi.py"
click node_workbook "https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/PartD_PowerBI.xlsx"
click node_powerbi_views "https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/export_powerbi.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_downloader,node_rawcsv toneBlue
class node_cleaning,node_aggregates,node_cms toneAmber
class node_upload,node_demo,node_filters,node_kpis,node_specialty,node_geography,node_prescriber toneMint
class node_exporter,node_workbook,node_powerbi_views toneRose
class node_analyst,node_powerbi toneIndigo
```

## Components

### Data acquisition

- [CMS downloader](https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/download_data.py): `download_data.py`
- **Raw annual CSVs**

### Data preparation

- [Clean and enrich](https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/preprocess.py): `preprocess.py`
- [Analytical tables](https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/preprocess.py): `preprocess.py`

### Streamlit analytics

- [CSV upload pipeline](https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/app.py): `app.py`
- [Demo baseline](https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/app.py): `app.py`
- [Year and state filters](https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/app.py): `app.py`
- [KPI summary](https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/app.py): `app.py`
- [Specialty profiles](https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/app.py): `app.py`
- [Geographic analysis](https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/app.py): `app.py`
- [Prescriber analysis](https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/app.py): `app.py`

### Power BI reporting

- [Workbook exporter](https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/export_powerbi.py): `export_powerbi.py`
- [Power BI workbook](https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/PartD_PowerBI.xlsx): `PartD_PowerBI.xlsx`
- [Power BI report views](https://github.com/ashishallu/pharma-sales-market-access-dashboard/blob/main/export_powerbi.py): `export_powerbi.py`

### Other components

- **Analyst**
- **CMS data**
- **Power BI analyst**

## Connections

- CMS data → CMS downloader: provides data (evidence: `download_data.py`)
- CMS downloader → Raw annual CSVs: saves CSVs (evidence: `download_data.py`)
- Raw annual CSVs → Clean and enrich: loads yearly data (evidence: `preprocess.py`)
- Clean and enrich → Analytical tables: writes summaries (evidence: `preprocess.py`)
- Analyst → CSV upload pipeline: uploads CSV (evidence: `README.md`)
- CSV upload pipeline → Year and state filters: prepares app data (evidence: `app.py`)
- Demo baseline → Year and state filters: supplies baseline (evidence: `app.py`)
- Analyst → Year and state filters: selects scope (evidence: `app.py`)
- Year and state filters → KPI summary: summarizes (evidence: `app.py`)
- Year and state filters → Specialty profiles: groups specialty spend (evidence: `app.py`)
- Year and state filters → Geographic analysis: groups state spend (evidence: `app.py`)
- Year and state filters → Prescriber analysis: compares providers (evidence: `app.py`)
- Analytical tables → Workbook exporter: reads processed tables (evidence: `README.md`)
- Workbook exporter → Power BI workbook: writes sheets (evidence: `export_powerbi.py`)
- Power BI workbook → Power BI analyst: imports workbook (evidence: `README.md`)
- Power BI analyst → Power BI report views: explores report (evidence: `README.md`)
