# ahmadawais/corona-cli architecture

> Architecture diagram of the GitHub repository ahmadawais/corona-cli, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ahmadawais/corona-cli
- Repository: https://github.com/ahmadawais/corona-cli

## Overview

corona-cli is a terminal COVID-19 reporting tool. Users select worldwide, country, or U.S. state data, then view sorted and limited tabular/JSON results or country line charts and regional bar charts. The main entry point coordinates these distinct reporting paths; data comes from disease.sh, while utility modules format values and define table fields and sorting keys. The graph follows calls visible in the sampled source; README-documented capabilities are retained, but unsampled implementation details are not expanded.

Main entry points: [`index.js`](https://github.com/ahmadawais/corona-cli/blob/master/index.js) (Command entry), [`utils/getStates.js`](https://github.com/ahmadawais/corona-cli/blob/master/utils/getStates.js) (State reports), [`utils/getCountries.js`](https://github.com/ahmadawais/corona-cli/blob/master/utils/getCountries.js) (Country reports), [`utils/getWorldwide.js`](https://github.com/ahmadawais/corona-cli/blob/master/utils/getWorldwide.js) (Worldwide totals)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and orchestration"]
  node_main["Command entry<br/>[index.js]"]
  node_cli["Arguments and help<br/>[cli.js]"]
  node_startup["Startup checks<br/>[init.js]"]
  node_finish["Summary footer<br/>[theEnd.js]"]
end

subgraph group_retrieval["Data retrieval"]
  node_worldwide["Worldwide totals<br/>[getWorldwide.js]"]
  node_country["Country report<br/>[getCountry.js]"]
  node_states["State reports<br/>[getStates.js]"]
  node_countries["Country reports<br/>[getCountries.js]"]
end

subgraph group_presentation["Reports and charts"]
  node_countrychart["Country line chart<br/>[getCountryChart.js]"]
  node_bars["Regional bar chart<br/>[getBar.js]"]
  node_json["JSON output<br/>[JsonOutput.js]"]
end

subgraph group_formatting["Formatting utilities"]
  node_table["Table fields and keys<br/>[table.js]"]
  node_number["Number formatting<br/>[numberFormat.js]"]
end

node_user(("Terminal user"))
node_api["disease.sh API"]
node_terminal["Terminal output"]

node_user -->|"runs command"| node_main
node_main -->|"reads options"| node_cli
node_main -->|"initializes"| node_startup
node_main -->|"requests totals"| node_worldwide
node_main -->|"requests country"| node_country
node_main -->|"requests states"| node_states
node_main -->|"requests countries"| node_countries
node_main -->|"requests chart"| node_countrychart
node_main -->|"requests bars"| node_bars
node_main -->|"prints footer"| node_finish
node_worldwide -->|"fetches totals"| node_api
node_country -->|"fetches country"| node_api
node_states -->|"fetches states"| node_api
node_countries -->|"fetches countries"| node_api
node_countrychart -->|"fetches history"| node_api
node_bars -->|"fetches regions"| node_api
node_worldwide -->|"formats values"| node_number
node_country -->|"formats values"| node_number
node_states -->|"formats values"| node_number
node_countries -->|"formats values"| node_number
node_countries -->|"reads sort keys"| node_table
node_states -->|"reads sort keys"| node_table
node_bars -->|"reads sort keys"| node_table
node_main -->|"selects JSON output"| node_json
node_worldwide -->|"prints report"| node_terminal
node_country -->|"prints report"| node_terminal
node_states -->|"prints report"| node_terminal
node_countries -->|"prints report"| node_terminal
node_countrychart -->|"renders chart"| node_terminal
node_bars -->|"renders chart"| node_terminal
node_finish -->|"prints summary"| node_terminal

click node_main "https://github.com/ahmadawais/corona-cli/blob/master/index.js"
click node_cli "https://github.com/ahmadawais/corona-cli/blob/master/utils/cli.js"
click node_startup "https://github.com/ahmadawais/corona-cli/blob/master/utils/init.js"
click node_finish "https://github.com/ahmadawais/corona-cli/blob/master/utils/theEnd.js"
click node_worldwide "https://github.com/ahmadawais/corona-cli/blob/master/utils/getWorldwide.js"
click node_country "https://github.com/ahmadawais/corona-cli/blob/master/utils/getCountry.js"
click node_states "https://github.com/ahmadawais/corona-cli/blob/master/utils/getStates.js"
click node_countries "https://github.com/ahmadawais/corona-cli/blob/master/utils/getCountries.js"
click node_countrychart "https://github.com/ahmadawais/corona-cli/blob/master/utils/getCountryChart.js"
click node_bars "https://github.com/ahmadawais/corona-cli/blob/master/utils/getBar.js"
click node_table "https://github.com/ahmadawais/corona-cli/blob/master/utils/table.js"
click node_number "https://github.com/ahmadawais/corona-cli/blob/master/utils/numberFormat.js"
click node_json "https://github.com/ahmadawais/corona-cli/blob/master/utils/JsonOutput.js"

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_main,node_cli,node_startup,node_finish,node_user toneBlue
class node_worldwide,node_country,node_states,node_countries toneAmber
class node_countrychart,node_bars,node_json,node_api toneMint
class node_table,node_number toneRose
class node_terminal toneIndigo
```

## Components

### CLI and orchestration

- [Command entry](https://github.com/ahmadawais/corona-cli/blob/master/index.js): `index.js`
- [Arguments and help](https://github.com/ahmadawais/corona-cli/blob/master/utils/cli.js): `utils/cli.js`
- [Startup checks](https://github.com/ahmadawais/corona-cli/blob/master/utils/init.js): `utils/init.js`
- [Summary footer](https://github.com/ahmadawais/corona-cli/blob/master/utils/theEnd.js): `utils/theEnd.js`

### Data retrieval

- [Worldwide totals](https://github.com/ahmadawais/corona-cli/blob/master/utils/getWorldwide.js): `utils/getWorldwide.js`
- [Country report](https://github.com/ahmadawais/corona-cli/blob/master/utils/getCountry.js): `utils/getCountry.js`
- [State reports](https://github.com/ahmadawais/corona-cli/blob/master/utils/getStates.js): `utils/getStates.js`
- [Country reports](https://github.com/ahmadawais/corona-cli/blob/master/utils/getCountries.js): `utils/getCountries.js`

### Reports and charts

- [Country line chart](https://github.com/ahmadawais/corona-cli/blob/master/utils/getCountryChart.js): `utils/getCountryChart.js`
- [Regional bar chart](https://github.com/ahmadawais/corona-cli/blob/master/utils/getBar.js): `utils/getBar.js`
- [JSON output](https://github.com/ahmadawais/corona-cli/blob/master/utils/JsonOutput.js): `utils/JsonOutput.js`

### Formatting utilities

- [Table fields and keys](https://github.com/ahmadawais/corona-cli/blob/master/utils/table.js): `utils/table.js`
- [Number formatting](https://github.com/ahmadawais/corona-cli/blob/master/utils/numberFormat.js): `utils/numberFormat.js`

### Other components

- **Terminal user**
- **disease.sh API**
- **Terminal output**

## Connections

- Terminal user → Command entry: runs command
- Command entry → Arguments and help: reads options
- Command entry → Startup checks: initializes
- Command entry → Worldwide totals: requests totals
- Command entry → Country report: requests country
- Command entry → State reports: requests states
- Command entry → Country reports: requests countries
- Command entry → Country line chart: requests chart
- Command entry → Regional bar chart: requests bars
- Command entry → Summary footer: prints footer
- Worldwide totals → disease.sh API: fetches totals
- Country report → disease.sh API: fetches country
- State reports → disease.sh API: fetches states
- Country reports → disease.sh API: fetches countries
- Country line chart → disease.sh API: fetches history
- Regional bar chart → disease.sh API: fetches regions
- Worldwide totals → Number formatting: formats values
- Country report → Number formatting: formats values
- State reports → Number formatting: formats values
- Country reports → Number formatting: formats values
- Country reports → Table fields and keys: reads sort keys
- State reports → Table fields and keys: reads sort keys
- Regional bar chart → Table fields and keys: reads sort keys
- Command entry → JSON output: selects JSON output
- Worldwide totals → Terminal output: prints report
- Country report → Terminal output: prints report
- State reports → Terminal output: prints report
- Country reports → Terminal output: prints report
- Country line chart → Terminal output: renders chart
- Regional bar chart → Terminal output: renders chart
- Summary footer → Terminal output: prints summary
