# efranzin/citations architecture

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

- Interactive diagram: https://gitdiagram.com/efranzin/citations
- Repository: https://github.com/efranzin/citations

## Overview

This is a command-line tool for reporting citation counts and bibliometric indices for an INSPIRE-HEP author. The workflow parses options, loads a cached profile (downloading it when needed), filters records, and prints per-work and aggregate summaries. Separate calculation modules produce bibliometric indices and citation-distribution breakdowns. Edges are based on the shown calls and README; the local JSON cache is described in profile.py. The graph does not expand unsampled behavior beyond documented capabilities.

Main entry points: [`citations.py`](https://github.com/efranzin/citations/blob/master/citations.py) (Citation CLI), [`profile.py`](https://github.com/efranzin/citations/blob/master/profile.py) (Profile loader), [`parser.py`](https://github.com/efranzin/citations/blob/master/parser.py) (Option parsing), [`config.ini`](https://github.com/efranzin/citations/blob/master/config.ini) (CLI defaults)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Input and profile"]
  node_cli["Citation CLI<br/>[citations.py]"]
  node_options["Option parsing<br/>[parser.py]"]
  node_config["CLI defaults<br/>[config.ini]"]
  node_profile["Profile loader<br/>[profile.py]"]
  node_cache[("Local profile cache")]
end

subgraph group_analysis["Selection and analysis"]
  node_selection["Record selection<br/>[selection.py]"]
  node_metrics["Bibliometric indices<br/>[metrics.py]"]
end

subgraph group_output["Reporting"]
  node_summary["Citation summaries<br/>[summary.py]"]
end

node_user(("CLI user"))
node_inspire["INSPIRE-HEP API"]

node_user -->|"runs"| node_cli
node_cli -->|"imports options"| node_options
node_options -->|"reads defaults"| node_config
node_cli -->|"loads profile"| node_profile
node_profile -->|"reads or writes"| node_cache
node_profile -->|"downloads records"| node_inspire
node_profile -->|"returns records"| node_cli
node_cli -->|"filters records"| node_selection
node_cli -->|"computes indices"| node_metrics
node_cli -->|"prints summaries"| node_summary

click node_cli "https://github.com/efranzin/citations/blob/master/citations.py"
click node_options "https://github.com/efranzin/citations/blob/master/parser.py"
click node_config "https://github.com/efranzin/citations/blob/master/config.ini"
click node_profile "https://github.com/efranzin/citations/blob/master/profile.py"
click node_selection "https://github.com/efranzin/citations/blob/master/selection.py"
click node_metrics "https://github.com/efranzin/citations/blob/master/metrics.py"
click node_summary "https://github.com/efranzin/citations/blob/master/summary.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_cli,node_options,node_config,node_profile,node_cache,node_user toneBlue
class node_selection,node_metrics toneAmber
class node_summary,node_inspire toneMint
```

## Components

### Input and profile

- [Citation CLI](https://github.com/efranzin/citations/blob/master/citations.py): `citations.py`
- [Option parsing](https://github.com/efranzin/citations/blob/master/parser.py): `parser.py`
- [CLI defaults](https://github.com/efranzin/citations/blob/master/config.ini): `config.ini`
- [Profile loader](https://github.com/efranzin/citations/blob/master/profile.py): `profile.py`
- **Local profile cache**

### Selection and analysis

- [Record selection](https://github.com/efranzin/citations/blob/master/selection.py): `selection.py`
- [Bibliometric indices](https://github.com/efranzin/citations/blob/master/metrics.py): `metrics.py`

### Reporting

- [Citation summaries](https://github.com/efranzin/citations/blob/master/summary.py): `summary.py`

### Other components

- **CLI user**
- **INSPIRE-HEP API**

## Connections

- CLI user → Citation CLI: runs (evidence: `citations.py`)
- Citation CLI → Option parsing: imports options (evidence: `citations.py`)
- Option parsing → CLI defaults: reads defaults (evidence: `parser.py`)
- Citation CLI → Profile loader: loads profile (evidence: `citations.py`)
- Profile loader → Local profile cache: reads or writes (evidence: `profile.py`)
- Profile loader → INSPIRE-HEP API: downloads records (evidence: `profile.py`)
- Profile loader → Citation CLI: returns records (evidence: `citations.py`)
- Citation CLI → Record selection: filters records (evidence: `citations.py`)
- Citation CLI → Bibliometric indices: computes indices (evidence: `citations.py`)
- Citation CLI → Citation summaries: prints summaries (evidence: `citations.py`)
