# aidanismail/pilog-cfr-dss architecture

> Architecture diagram of the GitHub repository aidanismail/pilog-cfr-dss, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aidanismail/pilog-cfr-dss
- Repository: https://github.com/aidanismail/pilog-cfr-dss

## Overview

PILOG Freight Desk is a Streamlit decision-support application for estimating dry-bulk freight and preparing a commercial brief. The user edits shipment, port, terms, cost, and vessel inputs; the application combines market and route references with capacity, time, and cost calculations, then presents vessel scenarios, recommendations, and exportable results. The README documents additional route-spread and package replay/import capabilities. Edges reflect README statements and visible source-index references; unsampled implementation details are not assumed.

Main entry points: [`src/pilog_cfr_dss/application/freight_desk.py`](https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/application/freight_desk.py) (Case workflow), [`src/pilog_cfr_dss/calculations/freight_desk.py`](https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/calculations/freight_desk.py) (Freight scenarios), [`src/pilog_cfr_dss/ui/views.py`](https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/ui/views.py) (Case editor), [`apps/streamlit_app.py`](https://github.com/aidanismail/pilog-cfr-dss/blob/main/apps/streamlit_app.py) (Streamlit entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_streamlit["Streamlit entry<br/>[streamlit_app.py]"]
  node_views["Case editor<br/>[views.py]"]
end

subgraph group_workflow["Case workflow"]
  node_models["Case schema<br/>[freight_desk.py]"]
  node_application["Case workflow<br/>[freight_desk.py]"]
  node_validation["Input validation<br/>[numbers.py]"]
end

subgraph group_calculation["Freight calculations"]
  node_calculator["Freight scenarios<br/>[freight_desk.py]"]
  node_capacity["Cargo capacity<br/>[capacity.py]"]
  node_port_time["Port time<br/>[port_time.py]"]
  node_costs["Cost components<br/>[costs.py]"]
  node_fuel["Fuel costs<br/>[fuel.py]"]
end

subgraph group_sources["Reference sources"]
  node_distance["Route distance<br/>[route_distance.py]"]
  node_voyage_inputs["Voyage estimates"]
  node_vessel_profiles["Vessel profiles<br/>[voyage_profiles.py]"]
  node_baltic["Baltic benchmarks<br/>[baltic_profiles.py]"]
  node_fearnpulse["Fearnpulse market<br/>[fearnpulse.py]"]
  node_kobc["KOBC assessments<br/>[kobc.py]"]
  node_reports["Fertilizer reports"]
end

subgraph group_results["Decision and reporting"]
  node_decisions["Option selection<br/>[freight_desk.py]"]
  node_brief["Commercial brief"]
  node_formatting["Result formatting<br/>[formatting.py]"]
end

node_user(("Freight analyst"))

node_user -->|"opens application"| node_streamlit
node_streamlit -->|"starts views"| node_views
node_views -->|"manages cases"| node_application
node_views -->|"shows brief"| node_brief
node_views -->|"formats results"| node_formatting
node_application -->|"uses schema"| node_models
node_application -->|"runs calculations"| node_calculator
node_application -->|"updates route"| node_distance
node_application -->|"loads estimates"| node_voyage_inputs
node_application -->|"loads profiles"| node_vessel_profiles
node_application -->|"checks profiles"| node_baltic
node_application -->|"loads assessments"| node_reports
node_application -->|"syncs benchmarks"| node_kobc
node_views -->|"refreshes market"| node_fearnpulse
node_calculator -->|"checks capacity"| node_capacity
node_calculator -->|"estimates duration"| node_port_time
node_calculator -->|"calculates hire"| node_costs
node_calculator -->|"calculates fuel"| node_fuel
node_calculator -->|"validates numbers"| node_validation
node_application -->|"validates inputs"| node_validation
node_calculator -.->|"selects options"| node_decisions
node_brief -->|"uses formatting"| node_formatting

click node_streamlit "https://github.com/aidanismail/pilog-cfr-dss/blob/main/apps/streamlit_app.py"
click node_views "https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/ui/views.py"
click node_models "https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/models/freight_desk.py"
click node_application "https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/application/freight_desk.py"
click node_validation "https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/validation/numbers.py"
click node_distance "https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/sources/route_distance.py"
click node_voyage_inputs "https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/sources/voyage_estimates.py"
click node_vessel_profiles "https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/sources/voyage_profiles.py"
click node_baltic "https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/sources/baltic_profiles.py"
click node_fearnpulse "https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/sources/fearnpulse.py"
click node_kobc "https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/sources/kobc.py"
click node_reports "https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/sources/fertilizer_reports.py"
click node_calculator "https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/calculations/freight_desk.py"
click node_capacity "https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/calculations/capacity.py"
click node_port_time "https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/calculations/port_time.py"
click node_costs "https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/calculations/costs.py"
click node_fuel "https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/calculations/fuel.py"
click node_decisions "https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/decisions/freight_desk.py"
click node_brief "https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/reporting/commercial_brief.py"
click node_formatting "https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/reporting/formatting.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_streamlit,node_views toneBlue
class node_models,node_application,node_validation toneAmber
class node_calculator,node_capacity,node_port_time,node_costs,node_fuel toneMint
class node_distance,node_voyage_inputs,node_vessel_profiles,node_baltic,node_fearnpulse,node_kobc,node_reports toneRose
class node_decisions,node_brief,node_formatting,node_user toneIndigo
```

## Components

### User interface

- [Streamlit entry](https://github.com/aidanismail/pilog-cfr-dss/blob/main/apps/streamlit_app.py): `apps/streamlit_app.py`
- [Case editor](https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/ui/views.py): `src/pilog_cfr_dss/ui/views.py`

### Case workflow

- [Case schema](https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/models/freight_desk.py): `src/pilog_cfr_dss/models/freight_desk.py`
- [Case workflow](https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/application/freight_desk.py): `src/pilog_cfr_dss/application/freight_desk.py`
- [Input validation](https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/validation/numbers.py): `src/pilog_cfr_dss/validation/numbers.py`

### Freight calculations

- [Freight scenarios](https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/calculations/freight_desk.py): `src/pilog_cfr_dss/calculations/freight_desk.py`
- [Cargo capacity](https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/calculations/capacity.py): `src/pilog_cfr_dss/calculations/capacity.py`
- [Port time](https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/calculations/port_time.py): `src/pilog_cfr_dss/calculations/port_time.py`
- [Cost components](https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/calculations/costs.py): `src/pilog_cfr_dss/calculations/costs.py`
- [Fuel costs](https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/calculations/fuel.py): `src/pilog_cfr_dss/calculations/fuel.py`

### Reference sources

- [Route distance](https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/sources/route_distance.py): `src/pilog_cfr_dss/sources/route_distance.py`
- [Voyage estimates](https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/sources/voyage_estimates.py): `src/pilog_cfr_dss/sources/voyage_estimates.py`
- [Vessel profiles](https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/sources/voyage_profiles.py): `src/pilog_cfr_dss/sources/voyage_profiles.py`
- [Baltic benchmarks](https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/sources/baltic_profiles.py): `src/pilog_cfr_dss/sources/baltic_profiles.py`
- [Fearnpulse market](https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/sources/fearnpulse.py): `src/pilog_cfr_dss/sources/fearnpulse.py`
- [KOBC assessments](https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/sources/kobc.py): `src/pilog_cfr_dss/sources/kobc.py`
- [Fertilizer reports](https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/sources/fertilizer_reports.py): `src/pilog_cfr_dss/sources/fertilizer_reports.py`

### Decision and reporting

- [Option selection](https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/decisions/freight_desk.py): `src/pilog_cfr_dss/decisions/freight_desk.py`
- [Commercial brief](https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/reporting/commercial_brief.py): `src/pilog_cfr_dss/reporting/commercial_brief.py`
- [Result formatting](https://github.com/aidanismail/pilog-cfr-dss/blob/main/src/pilog_cfr_dss/reporting/formatting.py): `src/pilog_cfr_dss/reporting/formatting.py`

### Other components

- **Freight analyst**

## Connections

- Freight analyst → Streamlit entry: opens application (evidence: `README.MD`)
- Streamlit entry → Case editor: starts views (evidence: `apps/streamlit_app.py`)
- Case editor → Case workflow: manages cases (evidence: `src/pilog_cfr_dss/ui/views.py`)
- Case editor → Commercial brief: shows brief (evidence: `src/pilog_cfr_dss/ui/views.py`)
- Case editor → Result formatting: formats results (evidence: `src/pilog_cfr_dss/ui/views.py`)
- Case workflow → Case schema: uses schema (evidence: `src/pilog_cfr_dss/application/freight_desk.py`)
- Case workflow → Freight scenarios: runs calculations (evidence: `src/pilog_cfr_dss/application/freight_desk.py`)
- Case workflow → Route distance: updates route (evidence: `src/pilog_cfr_dss/application/freight_desk.py`)
- Case workflow → Voyage estimates: loads estimates (evidence: `src/pilog_cfr_dss/application/freight_desk.py`)
- Case workflow → Vessel profiles: loads profiles (evidence: `src/pilog_cfr_dss/application/freight_desk.py`)
- Case workflow → Baltic benchmarks: checks profiles (evidence: `src/pilog_cfr_dss/application/freight_desk.py`)
- Case workflow → Fertilizer reports: loads assessments (evidence: `src/pilog_cfr_dss/application/freight_desk.py`)
- Case workflow → KOBC assessments: syncs benchmarks (evidence: `src/pilog_cfr_dss/application/freight_desk.py`)
- Case editor → Fearnpulse market: refreshes market (evidence: `src/pilog_cfr_dss/ui/views.py`)
- Freight scenarios → Cargo capacity: checks capacity (evidence: `src/pilog_cfr_dss/calculations/freight_desk.py`)
- Freight scenarios → Port time: estimates duration (evidence: `src/pilog_cfr_dss/calculations/freight_desk.py`)
- Freight scenarios → Cost components: calculates hire (evidence: `src/pilog_cfr_dss/calculations/freight_desk.py`)
- Freight scenarios → Fuel costs: calculates fuel (evidence: `src/pilog_cfr_dss/calculations/freight_desk.py`)
- Freight scenarios → Input validation: validates numbers (evidence: `src/pilog_cfr_dss/calculations/freight_desk.py`)
- Case workflow → Input validation: validates inputs (evidence: `src/pilog_cfr_dss/application/freight_desk.py`)
- Freight scenarios → Option selection: selects options
- Commercial brief → Result formatting: uses formatting (evidence: `src/pilog_cfr_dss/reporting/commercial_brief.py`)
