# fingerecho/trackingsite architecture

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

- Interactive diagram: https://gitdiagram.com/fingerecho/trackingsite
- Repository: https://github.com/fingerecho/trackingsite

## Overview

This is a web-based visit-tracking service with SPARQL query and graph-visualization endpoints. A client posts a visit token; the ASGI app extracts request headers, parses user-agent details, builds an RDF event, and stores it in Fuseki. Clients can also search via SPARQL and request Turtle or an ECharts graph. The excerpts show the main routing and persistence calls; other template and static-asset behavior is included only where the router names it.

Main entry points: [`src/service/serv.py`](https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/serv.py) (ASGI router), [`src/service/serv_method.py`](https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/serv_method.py) (Fuseki query adapter), [`src/service/database/rdf.py`](https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/database/rdf.py) (SPARQL storage client), [`src/service/config.py`](https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/config.py) (Service settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingress["HTTP service"]
  node_router["ASGI router<br/>[serv.py]"]
  node_static_assets["Static asset serving"]
end

subgraph group_tracking["Visit tracking"]
  node_request_parse["Visit request parsing<br/>[serv.py]"]
  node_ua_parse["User-agent enrichment<br/>[utils.py]"]
  node_event_build["RDF event creation<br/>[serv_method.py]"]
end

subgraph group_query["SPARQL and visualization"]
  node_query_dispatch["Query dispatch<br/>[serv.py]"]
  node_query_adapter["Fuseki query adapter<br/>[serv_method.py]"]
  node_graph_render["ECharts graph rendering<br/>[serv_method.py]"]
  node_graph_template["Graph HTML template"]
  node_search_template["SPARQL search page<br/>[sparql_search.html]"]
end

subgraph group_persistence["RDF persistence"]
  node_settings["Service settings<br/>[config.py]"]
  node_rdf_client["SPARQL storage client<br/>[rdf.py]"]
end

node_client(("HTTP client"))
node_fuseki[("Fuseki SPARQL store")]

node_client -->|"sends HTTP"| node_router
node_router -->|"dispatches visits"| node_request_parse
node_request_parse -->|"parses agent"| node_ua_parse
node_request_parse -->|"records visit"| node_event_build
node_event_build -->|"inserts graph"| node_rdf_client
node_rdf_client -->|"posts update"| node_fuseki
node_rdf_client -->|"reads endpoints"| node_settings
node_router -->|"routes searches"| node_query_dispatch
node_query_dispatch -->|"runs query"| node_query_adapter
node_query_adapter -->|"queries store"| node_fuseki
node_query_adapter -->|"reads settings"| node_settings
node_query_adapter -->|"renders graph"| node_graph_render
node_graph_render -->|"fills template"| node_graph_template
node_query_dispatch -->|"serves page"| node_search_template
node_router -->|"serves assets"| node_static_assets

click node_router "https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/serv.py"
click node_request_parse "https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/serv.py"
click node_ua_parse "https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/utils/utils.py"
click node_event_build "https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/serv_method.py"
click node_settings "https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/config.py"
click node_rdf_client "https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/database/rdf.py"
click node_query_dispatch "https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/serv.py"
click node_query_adapter "https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/serv_method.py"
click node_graph_render "https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/serv_method.py"
click node_graph_template "https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/template/graph_echarts_render.py"
click node_search_template "https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/template/sparql_search.html"
click node_static_assets "https://github.com/fingerecho/trackingsite/tree/updated_on_20190831/src/service/static"

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_router,node_static_assets,node_client toneBlue
class node_request_parse,node_ua_parse,node_event_build,node_fuseki toneAmber
class node_query_dispatch,node_query_adapter,node_graph_render,node_graph_template,node_search_template toneMint
class node_settings,node_rdf_client toneRose
```

## Components

### HTTP service

- [ASGI router](https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/serv.py): `src/service/serv.py`
- [Static asset serving](https://github.com/fingerecho/trackingsite/tree/updated_on_20190831/src/service/static): `src/service/static`

### Visit tracking

- [Visit request parsing](https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/serv.py): `src/service/serv.py`
- [User-agent enrichment](https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/utils/utils.py): `src/service/utils/utils.py`
- [RDF event creation](https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/serv_method.py): `src/service/serv_method.py`

### SPARQL and visualization

- [Query dispatch](https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/serv.py): `src/service/serv.py`
- [Fuseki query adapter](https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/serv_method.py): `src/service/serv_method.py`
- [ECharts graph rendering](https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/serv_method.py): `src/service/serv_method.py`
- [Graph HTML template](https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/template/graph_echarts_render.py): `src/service/template/graph_echarts_render.py`
- [SPARQL search page](https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/template/sparql_search.html): `src/service/template/sparql_search.html`

### RDF persistence

- [Service settings](https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/config.py): `src/service/config.py`
- [SPARQL storage client](https://github.com/fingerecho/trackingsite/blob/updated_on_20190831/src/service/database/rdf.py): `src/service/database/rdf.py`

### Other components

- **HTTP client**
- **Fuseki SPARQL store**

## Connections

- HTTP client → ASGI router: sends HTTP (evidence: `src/service/serv.py`)
- ASGI router → Visit request parsing: dispatches visits (evidence: `src/service/serv.py`)
- Visit request parsing → User-agent enrichment: parses agent (evidence: `src/service/serv.py`)
- Visit request parsing → RDF event creation: records visit (evidence: `src/service/serv.py`)
- RDF event creation → SPARQL storage client: inserts graph (evidence: `src/service/serv_method.py`)
- SPARQL storage client → Fuseki SPARQL store: posts update (evidence: `src/service/database/rdf.py`)
- SPARQL storage client → Service settings: reads endpoints (evidence: `src/service/database/rdf.py`)
- ASGI router → Query dispatch: routes searches (evidence: `src/service/serv.py`)
- Query dispatch → Fuseki query adapter: runs query (evidence: `src/service/serv.py`)
- Fuseki query adapter → Fuseki SPARQL store: queries store (evidence: `src/service/serv_method.py`)
- Fuseki query adapter → Service settings: reads settings (evidence: `src/service/serv_method.py`)
- Fuseki query adapter → ECharts graph rendering: renders graph (evidence: `src/service/serv_method.py`)
- ECharts graph rendering → Graph HTML template: fills template (evidence: `src/service/serv_method.py`)
- Query dispatch → SPARQL search page: serves page (evidence: `src/service/serv.py`)
- ASGI router → Static asset serving: serves assets (evidence: `src/service/serv.py`)
