# tmfg/metadata architecture

> Architecture diagram of the GitHub repository tmfg/metadata, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tmfg/metadata
- Repository: https://github.com/tmfg/metadata

## Overview

##### Project type and purpose
- This is an open‐source “legacy metadata” repository for the Digitraffic platform. It primarily contains static metadata (XLS, CSV, JSON, GeoJSON), XML/JSON schema definitions (XSD, WSDL), documentation (PDF), and simple ETL scripts.

##### File structure
- Top‐level folders:
- csv/, xls/ ─ static tabular metadata in CSV/XLS
- schema/ ─ XSD/WSDL schema definitions for various message formats
- geometry/regions/ ─ GeoJSON files defining administrative and transport regions
- descriptions/ ─ JSON lookup tables (e.g., roadConditions, trafficFluency)
- docs/ ─ human‐readable PDFs
- tools/scripts/ ─ shell scripts (bash) to transform XLS→CSV/JSON
- No “backend” or “frontend” code; it’s purely data + transformation.

##### README for additional insights
- Confirms that metadata is available via APIs (Digitraffic REST).
- Metadata in CSV/XLS has coordinate quirks (X/Y swapped).

## Diagram (Mermaid)

```mermaid
flowchart TD
  subgraph DataSources
    style DataSources fill:#D6E9F8,stroke:#4692E8
    XLS["XLS Files"]:::datasource
    CSV["CSV Files"]:::datasource
    Shapes["External Shape Files"]:::datasource
  end

  subgraph ETLLayer
    style ETLLayer fill:#FBE8A6,stroke:#E5A100
    ScriptsDir["Conversion Scripts Directory"]:::processing
    SpecificScript["convert_metadata_traffic_stations.sh"]:::processing
  end

  subgraph Artifacts
    style Artifacts fill:#DFF0D8,stroke:#3C763D
    OutCSV["Cleaned CSV Outputs"]:::storage
    OutJSON["Cleaned JSON Outputs"]:::storage
    JSONDesc["JSON Lookup Tables"]:::storage
    GeoJSON["GeoJSON Regions"]:::storage
    Schemas["Schemas (XSD/WSDL)"]:::storage
  end

  subgraph Documentation
    style Documentation fill:#FFF2CC,stroke:#D6B656
    Docs["PDF Documentation"]:::docs
  end

  subgraph Repository
    style Repository fill:#F2F2F2,stroke:#999
    Git["Git File System"]:::repo
    RepoMeta["Repository Metadata"]:::repo
  end

  subgraph Consumers
    style Consumers fill:#ECE2F0,stroke:#7C4199
    API["Digitraffic REST API"]:::consumer
    GIS["GIS Map Clients"]:::consumer
  end

  XLS -->|feeds| ScriptsDir
  CSV -->|feeds| ScriptsDir
  ScriptsDir -->|executes| SpecificScript
  ScriptsDir -->|generates| OutCSV
  ScriptsDir -->|generates| OutJSON
  JSONDesc -->|augments| OutJSON
  Shapes -->|provided as| GeoJSON

  OutCSV -->|versioned| Git
  OutJSON -->|versioned| Git
  GeoJSON -->|versioned| Git
  Schemas -->|versioned| Git
  Docs -->|versioned| Git
  RepoMeta -->|versioned| Git

  Git -->|serves metadata| API
  API -->|serves| GIS

  click XLS "https://github.com/tmfg/metadata/tree/master/xls/"
  click CSV "https://github.com/tmfg/metadata/tree/master/csv/"
  click ScriptsDir "https://github.com/tmfg/metadata/tree/master/tools/scripts/"
  click SpecificScript "https://github.com/tmfg/metadata/blob/master/tools/scripts/convert_metadata_traffic_stations.sh"
  click JSONDesc "https://github.com/tmfg/metadata/tree/master/descriptions/"
  click GeoJSON "https://github.com/tmfg/metadata/tree/master/geometry/regions/"
  click Schemas "https://github.com/tmfg/metadata/tree/master/schema/"
  click Docs "https://github.com/tmfg/metadata/tree/master/docs/"
  click RepoMeta "https://github.com/tmfg/metadata/blob/master/README.md"

  classDef datasource fill:#D6E9F8,stroke:#4692E8
  classDef processing fill:#FBE8A6,stroke:#E5A100
  classDef storage fill:#DFF0D8,stroke:#3C763D
  classDef docs fill:#FFF2CC,stroke:#D6B656
  classDef repo fill:#F2F2F2,stroke:#999
  classDef consumer fill:#ECE2F0,stroke:#7C4199
```
