# rezafaghani/timelens architecture

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

## Overview

TimeLens is a market-data platform whose main flow schedules provider ingestion, stores raw and parsed artifacts, inserts deduplicated time-series data, then exposes it for browsing, analytics, and quality review. The graph also preserves ingestion control, live market updates, and validation as distinct capabilities. The README documents the service pipeline and APIs; sampled source confirms several repository, artifact-worker, and validation responsibilities, but many subsystem internals were not excerpted, so uncertain connections are omitted.

Main entry points: [`src/TimeLens.API/Program.cs`](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.API/Program.cs) (HTTP API), [`src/TimeLens.Client/src/main.tsx`](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Client/src/main.tsx) (React client), [`src/TimeLens.Insert/IngestionArtifactWorker.cs`](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Insert/IngestionArtifactWorker.cs) (Artifact inserter), [`src/TimeLens.Validation.Worker/ValidationJobConsumer.cs`](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Validation.Worker/ValidationJobConsumer.cs) (Validation worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_client["React client<br/>[main.tsx]"]
  node_chart["Market chart<br/>[MarketChart.tsx]"]
  node_live["Live market updates<br/>[marketDataLive.ts]"]
end

subgraph group_api["API and control"]
  node_api_service["HTTP API<br/>[Program.cs]"]
  node_datasets_api["Dataset endpoints"]
  node_ingestion_api["Ingestion control"]
  node_analytics_api["Analytics endpoints"]
  node_quality_api["Quality endpoints"]
  node_hub["Market data hub<br/>[MarketDataHub.cs]"]
end

subgraph group_ingestion["Ingestion pipeline"]
  node_scheduler["Job scheduler<br/>[Worker.cs]"]
  node_broker["RabbitMQ"]
  node_worker["Provider ingestion<br/>[Worker.cs]"]
  node_provider_clients["Provider clients<br/>[Services]"]
  node_artifact_writer["Artifact writer"]
  node_insert_worker["Artifact inserter"]
end

subgraph group_storage["Persistence"]
  node_object_store[("SeaweedFS artifacts<br/>[S3ObjectStorage.cs]")]
  node_artifact_repo["Artifact tracking"]
  node_postgres[("PostgreSQL state<br/>[TimeLensContext.cs]")]
  node_timeseries_repo["Time-series repository"]
  node_clickhouse[("ClickHouse series<br/>[TimeLensContext.cs]")]
  node_dataset_repo["Dataset repository"]
end

subgraph group_quality["Analytics and quality"]
  node_quality_worker["Validation worker"]
  node_quality_engine["Quality engine"]
  node_quality_repo["Quality repository"]
  node_correlation["Cross-series analytics"]
end

node_user(("Platform user"))

node_user -->|"browses"| node_client
node_client -.->|"requests data"| node_api_service
node_client -->|"renders"| node_chart
node_client -->|"subscribes"| node_live
node_live -.->|"receives updates"| node_hub
node_api_service -->|"routes"| node_datasets_api
node_api_service -->|"routes"| node_ingestion_api
node_api_service -->|"routes"| node_analytics_api
node_api_service -->|"routes"| node_quality_api
node_ingestion_api -->|"queues backfills"| node_broker
node_scheduler -->|"queues jobs"| node_broker
node_broker -->|"dispatches jobs"| node_worker
node_worker -->|"fetches data"| node_provider_clients
node_worker -->|"writes artifacts"| node_artifact_writer
node_artifact_writer -->|"stores artifacts"| node_object_store
node_artifact_writer -->|"publishes artifact message"| node_broker
node_broker -->|"dispatches artifact"| node_insert_worker
node_insert_worker -->|"reads parsed artifact"| node_object_store
node_insert_worker -->|"records outcome"| node_artifact_repo
node_insert_worker -->|"inserts points"| node_timeseries_repo
node_artifact_repo -->|"tracks ingestion"| node_postgres
node_timeseries_repo -->|"writes series"| node_clickhouse
node_ingestion_api -->|"tracks jobs"| node_postgres
node_datasets_api -->|"searches metadata"| node_dataset_repo
node_dataset_repo -->|"reads metadata"| node_postgres
node_analytics_api -->|"computes correlation"| node_correlation
node_quality_api -->|"reads findings"| node_quality_repo
node_quality_worker -->|"evaluates checks"| node_quality_engine
node_quality_worker -.->|"records results"| node_quality_repo
node_quality_worker -->|"reads series"| node_timeseries_repo
node_quality_api -->|"queues validation"| node_broker

click node_client "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Client/src/main.tsx"
click node_chart "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Client/src/MarketChart.tsx"
click node_live "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Client/src/marketDataLive.ts"
click node_api_service "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.API/Program.cs"
click node_datasets_api "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.API/Controllers/DatasetsController.cs"
click node_ingestion_api "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.API/Controllers/IngestionControlController.cs"
click node_analytics_api "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.API/Controllers/AnalyticsController.cs"
click node_quality_api "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.API/Controllers/DataQualityController.cs"
click node_hub "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.API/Hubs/MarketDataHub.cs"
click node_scheduler "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Scheduler/Worker.cs"
click node_worker "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Ingestion/Worker.cs"
click node_provider_clients "https://github.com/rezafaghani/timelens/tree/main/src/TimeLens.Ingestion/Services"
click node_artifact_writer "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Ingestion/Services/IngestionArtifactWriter.cs"
click node_object_store "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Infrastructure/Services/S3ObjectStorage.cs"
click node_insert_worker "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Insert/IngestionArtifactWorker.cs"
click node_artifact_repo "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Infrastructure/Repositories/IngestionArtifactRepository.cs"
click node_postgres "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Infrastructure/TimeLensContext.cs"
click node_timeseries_repo "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Infrastructure/Repositories/TimeSeriesRepository.cs"
click node_clickhouse "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Infrastructure/TimeLensContext.cs"
click node_dataset_repo "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Infrastructure/Repositories/DatasetRepository.cs"
click node_quality_worker "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Validation.Worker/ValidationJobConsumer.cs"
click node_quality_engine "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Validation/QualityValidationEngine.cs"
click node_quality_repo "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Infrastructure/Repositories/QualityRepository.cs"
click node_correlation "https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.API/Controllers/AnalyticsController.cs"

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_client,node_chart,node_live,node_user toneBlue
class node_api_service,node_datasets_api,node_ingestion_api,node_analytics_api,node_quality_api,node_hub toneAmber
class node_scheduler,node_broker,node_worker,node_provider_clients,node_artifact_writer,node_insert_worker toneMint
class node_object_store,node_artifact_repo,node_postgres,node_timeseries_repo,node_clickhouse,node_dataset_repo toneRose
class node_quality_worker,node_quality_engine,node_quality_repo,node_correlation toneIndigo
```

## Components

### User experience

- [React client](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Client/src/main.tsx): `src/TimeLens.Client/src/main.tsx`
- [Market chart](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Client/src/MarketChart.tsx): `src/TimeLens.Client/src/MarketChart.tsx`
- [Live market updates](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Client/src/marketDataLive.ts): `src/TimeLens.Client/src/marketDataLive.ts`

### API and control

- [HTTP API](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.API/Program.cs): `src/TimeLens.API/Program.cs`
- [Dataset endpoints](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.API/Controllers/DatasetsController.cs): `src/TimeLens.API/Controllers/DatasetsController.cs`
- [Ingestion control](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.API/Controllers/IngestionControlController.cs): `src/TimeLens.API/Controllers/IngestionControlController.cs`
- [Analytics endpoints](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.API/Controllers/AnalyticsController.cs): `src/TimeLens.API/Controllers/AnalyticsController.cs`
- [Quality endpoints](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.API/Controllers/DataQualityController.cs): `src/TimeLens.API/Controllers/DataQualityController.cs`
- [Market data hub](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.API/Hubs/MarketDataHub.cs): `src/TimeLens.API/Hubs/MarketDataHub.cs`

### Ingestion pipeline

- [Job scheduler](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Scheduler/Worker.cs): `src/TimeLens.Scheduler/Worker.cs`
- **RabbitMQ**
- [Provider ingestion](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Ingestion/Worker.cs): `src/TimeLens.Ingestion/Worker.cs`
- [Provider clients](https://github.com/rezafaghani/timelens/tree/main/src/TimeLens.Ingestion/Services): `src/TimeLens.Ingestion/Services`
- [Artifact writer](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Ingestion/Services/IngestionArtifactWriter.cs): `src/TimeLens.Ingestion/Services/IngestionArtifactWriter.cs`
- [Artifact inserter](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Insert/IngestionArtifactWorker.cs): `src/TimeLens.Insert/IngestionArtifactWorker.cs`

### Persistence

- [SeaweedFS artifacts](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Infrastructure/Services/S3ObjectStorage.cs): `src/TimeLens.Infrastructure/Services/S3ObjectStorage.cs`
- [Artifact tracking](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Infrastructure/Repositories/IngestionArtifactRepository.cs): `src/TimeLens.Infrastructure/Repositories/IngestionArtifactRepository.cs`
- [PostgreSQL state](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Infrastructure/TimeLensContext.cs): `src/TimeLens.Infrastructure/TimeLensContext.cs`
- [Time-series repository](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Infrastructure/Repositories/TimeSeriesRepository.cs): `src/TimeLens.Infrastructure/Repositories/TimeSeriesRepository.cs`
- [ClickHouse series](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Infrastructure/TimeLensContext.cs): `src/TimeLens.Infrastructure/TimeLensContext.cs`
- [Dataset repository](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Infrastructure/Repositories/DatasetRepository.cs): `src/TimeLens.Infrastructure/Repositories/DatasetRepository.cs`

### Analytics and quality

- [Validation worker](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Validation.Worker/ValidationJobConsumer.cs): `src/TimeLens.Validation.Worker/ValidationJobConsumer.cs`
- [Quality engine](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Validation/QualityValidationEngine.cs): `src/TimeLens.Validation/QualityValidationEngine.cs`
- [Quality repository](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.Infrastructure/Repositories/QualityRepository.cs): `src/TimeLens.Infrastructure/Repositories/QualityRepository.cs`
- [Cross-series analytics](https://github.com/rezafaghani/timelens/blob/main/src/TimeLens.API/Controllers/AnalyticsController.cs): `src/TimeLens.API/Controllers/AnalyticsController.cs`

### Other components

- **Platform user**

## Connections

- Platform user → React client: browses (evidence: `README.md`)
- React client → HTTP API: requests data
- React client → Market chart: renders (evidence: `src/TimeLens.Client/src/main.tsx`)
- React client → Live market updates: subscribes (evidence: `src/TimeLens.Client/src/main.tsx`)
- Live market updates → Market data hub: receives updates
- HTTP API → Dataset endpoints: routes (evidence: `README.md`)
- HTTP API → Ingestion control: routes (evidence: `README.md`)
- HTTP API → Analytics endpoints: routes (evidence: `README.md`)
- HTTP API → Quality endpoints: routes (evidence: `README.md`)
- Ingestion control → RabbitMQ: queues backfills (evidence: `src/TimeLens.API/Controllers/IngestionControlController.cs`)
- Job scheduler → RabbitMQ: queues jobs (evidence: `README.md`)
- RabbitMQ → Provider ingestion: dispatches jobs (evidence: `README.md`)
- Provider ingestion → Provider clients: fetches data
- Provider ingestion → Artifact writer: writes artifacts
- Artifact writer → SeaweedFS artifacts: stores artifacts (evidence: `src/TimeLens.Ingestion/Services/IngestionArtifactWriter.cs`)
- Artifact writer → RabbitMQ: publishes artifact message (evidence: `src/TimeLens.Ingestion/Services/IngestionArtifactWriter.cs`)
- RabbitMQ → Artifact inserter: dispatches artifact (evidence: `README.md`)
- Artifact inserter → SeaweedFS artifacts: reads parsed artifact (evidence: `src/TimeLens.Insert/IngestionArtifactWorker.cs`)
- Artifact inserter → Artifact tracking: records outcome (evidence: `src/TimeLens.Insert/IngestionArtifactWorker.cs`)
- Artifact inserter → Time-series repository: inserts points (evidence: `src/TimeLens.Insert/IngestionArtifactWorker.cs`)
- Artifact tracking → PostgreSQL state: tracks ingestion (evidence: `src/TimeLens.Infrastructure/Repositories/IngestionArtifactRepository.cs`)
- Time-series repository → ClickHouse series: writes series (evidence: `README.md`)
- Ingestion control → PostgreSQL state: tracks jobs (evidence: `src/TimeLens.API/Controllers/IngestionControlController.cs`)
- Dataset endpoints → Dataset repository: searches metadata (evidence: `README.md`)
- Dataset repository → PostgreSQL state: reads metadata (evidence: `src/TimeLens.Infrastructure/Repositories/DatasetRepository.cs`)
- Analytics endpoints → Cross-series analytics: computes correlation (evidence: `README.md`)
- Quality endpoints → Quality repository: reads findings (evidence: `src/TimeLens.API/Controllers/DataQualityController.cs`)
- Validation worker → Quality engine: evaluates checks (evidence: `src/TimeLens.Validation.Worker/Program.cs`)
- Validation worker → Quality repository: records results
- Validation worker → Time-series repository: reads series (evidence: `src/TimeLens.Validation.Worker/Program.cs`)
- Quality endpoints → RabbitMQ: queues validation (evidence: `src/TimeLens.API/Controllers/DataQualityController.cs`)
