# dwyca-org/fmnarrative architecture

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

- Interactive diagram: https://gitdiagram.com/dwyca-org/fmnarrative
- Repository: https://github.com/dwyca-org/fmnarrative

## Overview

FMNarrative is a command-line Football Manager 24 press-conference assistant. A user supplies a match screenshot; the Python application invokes the C++ OCR executable, combines extracted match data with manager-provided match context, derives talking points, and requests question-and-answer content from Groq. The README documents the intended realistic, dynamic, context-aware press-conference experience; the sampled excerpts do not show the full prompt or response-display logic, so those details are kept broad.

Main entry points: [`main.py`](https://github.com/dwyca-org/fmnarrative/blob/main/main.py) (Groq client), [`ocr.cpp`](https://github.com/dwyca-org/fmnarrative/blob/main/ocr.cpp) (Screenshot OCR)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Match capture"]
  node_cli["Assistant CLI<br/>[main.py]"]
  node_ocr_runner["OCR invocation<br/>[main.py]"]
  node_ocr_engine["Screenshot OCR<br/>[ocr.cpp]"]
end

subgraph group_context["Match context"]
  node_match_stats["Match statistics<br/>[main.py]"]
  node_match_setup["Match setup<br/>[main.py]"]
  node_perspective["Team perspective<br/>[main.py]"]
  node_derived_metrics["Match analysis<br/>[main.py]"]
end

subgraph group_narrative["Press conference"]
  node_prompt["Question prompt<br/>[main.py]"]
  node_conference["Conference content<br/>[main.py]"]
end

subgraph group_integrations["External services"]
  node_opencv["OpenCV"]
  node_tesseract["Tesseract OCR"]
  node_groq_client["Groq client<br/>[main.py]"]
  node_groq["Groq language model"]
end

node_manager(("Manager"))

node_manager -->|"provides screenshot"| node_cli
node_cli -->|"runs OCR"| node_ocr_runner
node_ocr_runner -->|"passes image path"| node_ocr_engine
node_ocr_engine -->|"processes image"| node_opencv
node_ocr_engine -->|"recognizes text"| node_tesseract
node_ocr_engine -->|"returns extracted data"| node_ocr_runner
node_ocr_runner -->|"supplies OCR data"| node_match_stats
node_cli -->|"collects match context"| node_match_setup
node_match_stats -->|"provides team stats"| node_perspective
node_match_setup -->|"identifies manager team"| node_perspective
node_perspective -->|"feeds match analysis"| node_derived_metrics
node_derived_metrics -->|"informs questions"| node_prompt
node_match_setup -->|"adds match context"| node_prompt
node_cli -->|"requests completion"| node_groq_client
node_prompt -->|"provides prompt"| node_groq_client
node_groq_client -->|"sends chat request"| node_groq
node_groq -->|"returns completion"| node_groq_client
node_groq_client -->|"provides response"| node_conference
node_conference -->|"presents content"| node_manager

click node_cli "https://github.com/dwyca-org/fmnarrative/blob/main/main.py"
click node_ocr_runner "https://github.com/dwyca-org/fmnarrative/blob/main/main.py"
click node_ocr_engine "https://github.com/dwyca-org/fmnarrative/blob/main/ocr.cpp"
click node_match_stats "https://github.com/dwyca-org/fmnarrative/blob/main/main.py"
click node_match_setup "https://github.com/dwyca-org/fmnarrative/blob/main/main.py"
click node_perspective "https://github.com/dwyca-org/fmnarrative/blob/main/main.py"
click node_derived_metrics "https://github.com/dwyca-org/fmnarrative/blob/main/main.py"
click node_prompt "https://github.com/dwyca-org/fmnarrative/blob/main/main.py"
click node_groq_client "https://github.com/dwyca-org/fmnarrative/blob/main/main.py"
click node_conference "https://github.com/dwyca-org/fmnarrative/blob/main/main.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_ocr_runner,node_ocr_engine toneBlue
class node_match_stats,node_match_setup,node_perspective,node_derived_metrics toneAmber
class node_prompt,node_conference toneMint
class node_opencv,node_tesseract,node_groq_client,node_groq toneRose
class node_manager toneIndigo
```

## Components

### Match capture

- [Assistant CLI](https://github.com/dwyca-org/fmnarrative/blob/main/main.py): `main.py`
- [OCR invocation](https://github.com/dwyca-org/fmnarrative/blob/main/main.py): `main.py`
- [Screenshot OCR](https://github.com/dwyca-org/fmnarrative/blob/main/ocr.cpp): `ocr.cpp`

### Match context

- [Match statistics](https://github.com/dwyca-org/fmnarrative/blob/main/main.py): `main.py`
- [Match setup](https://github.com/dwyca-org/fmnarrative/blob/main/main.py): `main.py`
- [Team perspective](https://github.com/dwyca-org/fmnarrative/blob/main/main.py): `main.py`
- [Match analysis](https://github.com/dwyca-org/fmnarrative/blob/main/main.py): `main.py`

### Press conference

- [Question prompt](https://github.com/dwyca-org/fmnarrative/blob/main/main.py): `main.py`
- [Conference content](https://github.com/dwyca-org/fmnarrative/blob/main/main.py): `main.py`

### External services

- **OpenCV**
- **Tesseract OCR**
- [Groq client](https://github.com/dwyca-org/fmnarrative/blob/main/main.py): `main.py`
- **Groq language model**

### Other components

- **Manager**

## Connections

- Manager → Assistant CLI: provides screenshot
- Assistant CLI → OCR invocation: runs OCR
- OCR invocation → Screenshot OCR: passes image path
- Screenshot OCR → OpenCV: processes image
- Screenshot OCR → Tesseract OCR: recognizes text
- Screenshot OCR → OCR invocation: returns extracted data
- OCR invocation → Match statistics: supplies OCR data
- Assistant CLI → Match setup: collects match context
- Match statistics → Team perspective: provides team stats
- Match setup → Team perspective: identifies manager team
- Team perspective → Match analysis: feeds match analysis
- Match analysis → Question prompt: informs questions
- Match setup → Question prompt: adds match context
- Assistant CLI → Groq client: requests completion
- Question prompt → Groq client: provides prompt
- Groq client → Groq language model: sends chat request
- Groq language model → Groq client: returns completion
- Groq client → Conference content: provides response
- Conference content → Manager: presents content
