# miklemkhlv/mdmgeneratorprofile architecture

> Architecture diagram of the GitHub repository miklemkhlv/mdmgeneratorprofile, 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/miklemkhlv/mdmgeneratorprofile
- Repository: https://github.com/miklemkhlv/mdmgeneratorprofile

## Overview

This Go service generates MDM-shaped citizen and organization data, sends it through RabbitMQ, and processes incoming MDM records for change tracking. Its principal workflow is mode-driven generation and publishing, followed by asynchronous lookup/enrichment and Redis persistence; during graceful shutdown it compares stored versions and emits composition results and Allure artifacts. The sampled entry point and services establish the orchestration and comparison flow; search internals and job implementations were not sampled, so their finer-grained wiring is not expanded.

Main entry points: [`cmd/app/main.go`](https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/cmd/app/main.go) (App orchestration), [`internal/service/compasition/compasitionService.go`](https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/internal/service/compasition/compasitionService.go) (Version comparison), [`internal/broker/rabbit/rabbit.go`](https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/internal/broker/rabbit/rabbit.go) (RabbitMQ adapter), [`internal/reposytory/redis.go`](https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/internal/reposytory/redis.go) (Redis repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_generation["Data generation"]
  node_jobs["Generation jobs<br/>[jobs.go]"]
  node_generator["Record generator<br/>[generator.go]"]
  node_models["MDM models<br/>[model.go]"]
end

subgraph group_messaging["Messaging"]
  node_main["App orchestration<br/>[main.go]"]
  node_config["Runtime config<br/>[config.go]"]
  node_rabbit["RabbitMQ adapter<br/>[rabbit.go]"]
  node_logs["Log writer<br/>[writer.go]"]
end

subgraph group_search["Search and storage"]
  node_searchsvc["Search worker<br/>[searchService.go]"]
  node_searchpipe["Search pipeline<br/>[stepsPipline.go]"]
  node_searchhttp["MDM lookup client<br/>[http.go]"]
  node_redisrepo["Redis repository<br/>[redis.go]"]
  node_redis[("Version cache")]
end

subgraph group_comparison["Comparison and reporting"]
  node_dto["Change DTOs"]
  node_composition["Version comparison"]
  node_comparegen["Comparison logic"]
  node_allure["Allure results<br/>[allure.go]"]
end

node_operator(("Operator"))
node_rabbitmq["RabbitMQ"]
node_alluresvc["Allure report service"]
node_logfiles["Log files"]

node_operator -->|"starts"| node_main
node_main -->|"loads"| node_config
node_main -->|"selects mode"| node_jobs
node_main -->|"starts consumer"| node_rabbit
node_main -->|"publishes records"| node_rabbit
node_rabbit -->|"consumes and publishes"| node_rabbitmq
node_rabbitmq -->|"delivers messages"| node_rabbit
node_main -->|"starts worker"| node_searchsvc
node_searchsvc -->|"runs pipeline"| node_searchpipe
node_searchpipe -->|"reads and writes"| node_redisrepo
node_searchpipe -->|"looks up MDM"| node_searchhttp
node_searchhttp -.->|"queries MDM service"| node_operator
node_redisrepo -->|"reads and writes"| node_redis
node_main -->|"runs at shutdown"| node_composition
node_composition -->|"scans and reads"| node_redisrepo
node_composition -->|"deletes processed keys"| node_redisrepo
node_composition -->|"decodes changes"| node_dto
node_composition -->|"builds comparison"| node_comparegen
node_composition -->|"writes results"| node_allure
node_allure -.->|"provides result files"| node_alluresvc
node_main -->|"runs writers"| node_logs
node_composition -->|"emits composition logs"| node_logs
node_logs -->|"writes"| node_logfiles

click node_main "https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/cmd/app/main.go"
click node_config "https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/config/config.go"
click node_jobs "https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/internal/jobs/jobs.go"
click node_generator "https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/internal/generator/generator.go"
click node_models "https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/model/model.go"
click node_rabbit "https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/internal/broker/rabbit/rabbit.go"
click node_searchsvc "https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/internal/service/search/searchService.go"
click node_searchpipe "https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/internal/service/search/stepsPipline.go"
click node_searchhttp "https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/internal/service/search/http.go"
click node_redisrepo "https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/internal/reposytory/redis.go"
click node_dto "https://github.com/miklemkhlv/mdmgeneratorprofile/tree/main/model/dto"
click node_composition "https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/internal/service/compasition/compasitionService.go"
click node_comparegen "https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/model/dto/composition_generated.go"
click node_allure "https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/pkg/allure/allure.go"
click node_logs "https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/internal/logs/writer.go"

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_jobs,node_generator,node_models toneBlue
class node_main,node_config,node_rabbit,node_logs toneAmber
class node_searchsvc,node_searchpipe,node_searchhttp,node_redisrepo,node_redis toneMint
class node_dto,node_composition,node_comparegen,node_allure toneRose
class node_operator,node_rabbitmq,node_alluresvc,node_logfiles toneIndigo
```

## Components

### Data generation

- [Generation jobs](https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/internal/jobs/jobs.go): `internal/jobs/jobs.go`
- [Record generator](https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/internal/generator/generator.go): `internal/generator/generator.go`
- [MDM models](https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/model/model.go): `model/model.go`

### Messaging

- [App orchestration](https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/cmd/app/main.go): `cmd/app/main.go`
- [Runtime config](https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/config/config.go): `config/config.go`
- [RabbitMQ adapter](https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/internal/broker/rabbit/rabbit.go): `internal/broker/rabbit/rabbit.go`
- [Log writer](https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/internal/logs/writer.go): `internal/logs/writer.go`

### Search and storage

- [Search worker](https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/internal/service/search/searchService.go): `internal/service/search/searchService.go`
- [Search pipeline](https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/internal/service/search/stepsPipline.go): `internal/service/search/stepsPipline.go`
- [MDM lookup client](https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/internal/service/search/http.go): `internal/service/search/http.go`
- [Redis repository](https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/internal/reposytory/redis.go): `internal/reposytory/redis.go`
- **Version cache**

### Comparison and reporting

- [Change DTOs](https://github.com/miklemkhlv/mdmgeneratorprofile/tree/main/model/dto): `model/dto`
- [Version comparison](https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/internal/service/compasition/compasitionService.go): `internal/service/compasition/compasitionService.go`
- [Comparison logic](https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/model/dto/composition_generated.go): `model/dto/composition_generated.go`
- [Allure results](https://github.com/miklemkhlv/mdmgeneratorprofile/blob/main/pkg/allure/allure.go): `pkg/allure/allure.go`

### Other components

- **Operator**
- **RabbitMQ**
- **Allure report service**
- **Log files**

## Connections

- Operator → App orchestration: starts
- App orchestration → Runtime config: loads
- App orchestration → Generation jobs: selects mode
- App orchestration → RabbitMQ adapter: starts consumer
- App orchestration → RabbitMQ adapter: publishes records
- RabbitMQ adapter → RabbitMQ: consumes and publishes
- RabbitMQ → RabbitMQ adapter: delivers messages
- App orchestration → Search worker: starts worker
- Search worker → Search pipeline: runs pipeline
- Search pipeline → Redis repository: reads and writes
- Search pipeline → MDM lookup client: looks up MDM
- MDM lookup client → Operator: queries MDM service
- Redis repository → Version cache: reads and writes
- App orchestration → Version comparison: runs at shutdown
- Version comparison → Redis repository: scans and reads
- Version comparison → Redis repository: deletes processed keys
- Version comparison → Change DTOs: decodes changes
- Version comparison → Comparison logic: builds comparison
- Version comparison → Allure results: writes results
- Allure results → Allure report service: provides result files
- App orchestration → Log writer: runs writers
- Version comparison → Log writer: emits composition logs
- Log writer → Log files: writes
