# tarun-015/oil-safety-intelligence architecture

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

- Interactive diagram: https://gitdiagram.com/tarun-015/oil-safety-intelligence
- Repository: https://github.com/tarun-015/oil-safety-intelligence

## Overview

This is a Streamlit safety-intelligence prototype whose implemented workflow analyzes safety-report text, derives SIF and hazard findings, scores risk, recommends actions, and presents report-level and aggregate results. Asset and workforce readiness, plus user-driven integrated assessment, are documented platform extensions; their source files are present but empty in the supplied excerpts, so those branches are shown as planned rather than as verified runtime flows.

Main entry points: [`src/nlp_engine.py`](https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/nlp_engine.py) (Text preparation), [`src/app.py`](https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/app.py) (Safety dashboard), [`src/safety_engine.py`](https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/safety_engine.py) (Integrated decision), [`data/safety_reports.xlsx`](https://github.com/tarun-015/oil-safety-intelligence/blob/main/data/safety_reports.xlsx) (Safety reports)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_dashboard["Safety dashboard<br/>[app.py]"]
end

subgraph group_analysis["Safety analysis"]
  node_report_data[("Safety reports")]
  node_preprocess["Text preparation<br/>[nlp_engine.py]"]
  node_sif["SIF classification<br/>[nlp_engine.py]"]
  node_findings["Hazard and barrier findings<br/>[nlp_engine.py]"]
  node_rules["IOGP rule mapping<br/>[nlp_engine.py]"]
  node_risk["Risk scoring<br/>[nlp_engine.py]"]
  node_actions["Action recommendations<br/>[nlp_engine.py]"]
end

subgraph group_readiness["Readiness extensions"]
  node_asset_readiness["Asset readiness<br/>[asset_engine.py]"]
  node_asset_page["Asset dashboard"]
  node_workforce_readiness["Workforce readiness"]
  node_workforce_page["Workforce dashboard"]
end

subgraph group_integration["Integrated assessment"]
  node_assessment["Safety assessment"]
  node_integration_engine["Integrated decision<br/>[safety_engine.py]"]
end

node_safety_team(("Safety team"))

node_safety_team -->|"views analysis"| node_dashboard
node_dashboard -->|"runs pipeline"| node_preprocess
node_report_data -->|"loads reports"| node_preprocess
node_preprocess -->|"prepares text"| node_sif
node_preprocess -->|"analyzes text"| node_findings
node_preprocess -->|"maps rules"| node_rules
node_sif -->|"informs score"| node_risk
node_findings -->|"informs score"| node_risk
node_risk -->|"guides actions"| node_actions
node_dashboard -.->|"offers extension"| node_asset_page
node_dashboard -.->|"offers extension"| node_workforce_page
node_assessment -.->|"requests decision"| node_integration_engine
node_integration_engine -.->|"evaluates readiness"| node_asset_readiness
node_integration_engine -.->|"evaluates readiness"| node_workforce_readiness
node_integration_engine -.->|"combines findings"| node_risk

click node_dashboard "https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/app.py"
click node_report_data "https://github.com/tarun-015/oil-safety-intelligence/blob/main/data/safety_reports.xlsx"
click node_preprocess "https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/nlp_engine.py"
click node_sif "https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/nlp_engine.py"
click node_findings "https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/nlp_engine.py"
click node_rules "https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/nlp_engine.py"
click node_risk "https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/nlp_engine.py"
click node_actions "https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/nlp_engine.py"
click node_asset_readiness "https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/asset_engine.py"
click node_asset_page "https://github.com/tarun-015/oil-safety-intelligence/blob/main/pages/2_Asset_Readiness.py"
click node_workforce_readiness "https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/workforce_engine.py"
click node_workforce_page "https://github.com/tarun-015/oil-safety-intelligence/blob/main/pages/3_Workforce_Readiness.py"
click node_assessment "https://github.com/tarun-015/oil-safety-intelligence/blob/main/pages/4_Safety_Assessment.py"
click node_integration_engine "https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/safety_engine.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_dashboard toneBlue
class node_report_data,node_preprocess,node_sif,node_findings,node_rules,node_risk,node_actions toneAmber
class node_asset_readiness,node_asset_page,node_workforce_readiness,node_workforce_page toneMint
class node_assessment,node_integration_engine toneRose
class node_safety_team toneIndigo
```

## Components

### User experience

- [Safety dashboard](https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/app.py): `src/app.py`

### Safety analysis

- [Safety reports](https://github.com/tarun-015/oil-safety-intelligence/blob/main/data/safety_reports.xlsx): `data/safety_reports.xlsx`
- [Text preparation](https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/nlp_engine.py): `src/nlp_engine.py`
- [SIF classification](https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/nlp_engine.py): `src/nlp_engine.py`
- [Hazard and barrier findings](https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/nlp_engine.py): `src/nlp_engine.py`
- [IOGP rule mapping](https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/nlp_engine.py): `src/nlp_engine.py`
- [Risk scoring](https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/nlp_engine.py): `src/nlp_engine.py`
- [Action recommendations](https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/nlp_engine.py): `src/nlp_engine.py`

### Readiness extensions

- [Asset readiness](https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/asset_engine.py): `src/asset_engine.py`
- [Asset dashboard](https://github.com/tarun-015/oil-safety-intelligence/blob/main/pages/2_Asset_Readiness.py): `pages/2_Asset_Readiness.py`
- [Workforce readiness](https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/workforce_engine.py): `src/workforce_engine.py`
- [Workforce dashboard](https://github.com/tarun-015/oil-safety-intelligence/blob/main/pages/3_Workforce_Readiness.py): `pages/3_Workforce_Readiness.py`

### Integrated assessment

- [Safety assessment](https://github.com/tarun-015/oil-safety-intelligence/blob/main/pages/4_Safety_Assessment.py): `pages/4_Safety_Assessment.py`
- [Integrated decision](https://github.com/tarun-015/oil-safety-intelligence/blob/main/src/safety_engine.py): `src/safety_engine.py`

### Other components

- **Safety team**

## Connections

- Safety team → Safety dashboard: views analysis (evidence: `README.md`)
- Safety dashboard → Text preparation: runs pipeline (evidence: `src/app.py`)
- Safety reports → Text preparation: loads reports (evidence: `src/nlp_engine.py`)
- Text preparation → SIF classification: prepares text (evidence: `README.md`)
- Text preparation → Hazard and barrier findings: analyzes text (evidence: `README.md`)
- Text preparation → IOGP rule mapping: maps rules (evidence: `README.md`)
- SIF classification → Risk scoring: informs score (evidence: `README.md`)
- Hazard and barrier findings → Risk scoring: informs score (evidence: `README.md`)
- Risk scoring → Action recommendations: guides actions (evidence: `README.md`)
- Safety dashboard → Asset dashboard: offers extension (evidence: `README.md`)
- Safety dashboard → Workforce dashboard: offers extension (evidence: `README.md`)
- Safety assessment → Integrated decision: requests decision (evidence: `README.md`)
- Integrated decision → Asset readiness: evaluates readiness (evidence: `README.md`)
- Integrated decision → Workforce readiness: evaluates readiness (evidence: `README.md`)
- Integrated decision → Risk scoring: combines findings (evidence: `README.md`)
