# tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf architecture

> Architecture diagram of the GitHub repository tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf
- Repository: https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf

## Overview

RECON combines a video-to-Unity 3D reconstruction pipeline with a web case-management and evidence-custody application. The main loop is capture upload, scene/job creation, GPU reconstruction, result storage, and Unity asset retrieval with unitScale applied in Unity. The web app also supports case and scene browsing, job status, custody verification, scene anchors, and encrypted asset storage. Edges reflect README statements or shown source calls; the GPU pipeline’s internal stage links are documented at a high level, while unsampled web routes are not connected speculatively.

Main entry points: [`gpu/run_scene.py`](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/gpu/run_scene.py) (GPU reconstruction), [`gpu/worker.py`](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/gpu/worker.py) (GPU job worker), [`web/src/app/api/uploads/route.ts`](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/app/api/uploads/route.ts) (Upload endpoint), [`web/src/app/api/cases/route.ts`](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/app/api/cases/route.ts) (Case endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gpu["Reconstruction pipeline"]
  node_gpu_pipeline["GPU reconstruction<br/>[run_scene.py]"]
  node_unit_scale["Compute unitScale"]
  node_unity_convert["Unity PLY conversion"]
  node_splat_tools["Splat utilities<br/>[decimate_splats.py]"]
  node_mesh_tool["Mesh conversion<br/>[splat_to_mesh.py]"]
  node_gpu_worker["GPU job worker<br/>[worker.py]"]
end

subgraph group_web["Web application"]
  node_web_ui["Case and scene UI<br/>[case-detail.tsx]"]
  node_upload_api["Upload endpoint<br/>[route.ts]"]
  node_cases_api["Case endpoints<br/>[route.ts]"]
  node_jobs_api["Job endpoints<br/>[route.ts]"]
  node_asset_api["Scene asset endpoint<br/>[route.ts]"]
  node_scene_api["Scene and anchor APIs<br/>[route.ts]"]
  node_custody_api["Custody verification<br/>[route.ts]"]
end

subgraph group_evidence["Evidence services"]
  node_custody["Hash-chain audit<br/>[custody.ts]"]
  node_anchor["Scene anchoring<br/>[anchor.ts]"]
  node_storage["Asset storage<br/>[storage.ts]"]
  node_encryption["Asset encryption<br/>[encryption.ts]"]
end

subgraph group_state["Persistent state"]
  node_queue["Reconstruction queue<br/>[queue.ts]"]
  node_postgres[("PostgreSQL records<br/>[prisma.ts]")]
end

node_phone(("Capture video"))
node_investigator(("Investigator"))
node_unity(("Unity client"))
node_redis[("Redis")]

node_phone -->|"processes video"| node_gpu_pipeline
node_gpu_pipeline -->|"runs stage"| node_unit_scale
node_gpu_pipeline -->|"runs stage"| node_unity_convert
node_gpu_pipeline -->|"worker launches"| node_gpu_worker
node_investigator -->|"uploads capture"| node_upload_api
node_upload_api -->|"creates scene and job"| node_postgres
node_upload_api -->|"writes video"| node_storage
node_upload_api -->|"appends audit"| node_custody
node_upload_api -->|"enqueues job"| node_queue
node_queue -->|"stores queue job"| node_redis
node_gpu_worker -->|"claims and reports"| node_jobs_api
node_gpu_worker -->|"runs reconstruction"| node_gpu_pipeline
node_gpu_worker -->|"uploads result"| node_jobs_api
node_gpu_worker -.->|"job state recorded"| node_postgres
node_unity -->|"fetches scene asset"| node_asset_api
node_asset_api -.->|"streams asset"| node_storage
node_storage -->|"encrypts and decrypts"| node_encryption
node_investigator -->|"manages cases"| node_cases_api
node_cases_api -->|"reads and creates"| node_postgres
node_cases_api -->|"audits case creation"| node_custody
node_custody_api -.->|"verifies chain"| node_custody
node_scene_api -.->|"handles transforms"| node_anchor
node_web_ui -.->|"presents case details"| node_investigator
node_splat_tools -.->|"post-processes output"| node_gpu_pipeline
node_mesh_tool -.->|"creates collider mesh"| node_gpu_pipeline

click node_gpu_pipeline "https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/gpu/run_scene.py"
click node_unit_scale "https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/tools/compute_unitscale.py"
click node_unity_convert "https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/tools/convert_ply_to_unity.py"
click node_splat_tools "https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/tools/decimate_splats.py"
click node_mesh_tool "https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/tools/splat_to_mesh.py"
click node_gpu_worker "https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/gpu/worker.py"
click node_web_ui "https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/app/(dashboard)/cases/%5Bid%5D/case-detail.tsx"
click node_upload_api "https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/app/api/uploads/route.ts"
click node_cases_api "https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/app/api/cases/route.ts"
click node_jobs_api "https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/app/api/jobs/route.ts"
click node_asset_api "https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/app/api/scenes/%5Bid%5D/asset/route.ts"
click node_scene_api "https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/app/api/scenes/%5Bid%5D/anchor/route.ts"
click node_custody_api "https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/app/api/custody/verify/route.ts"
click node_custody "https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/lib/custody.ts"
click node_anchor "https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/lib/anchor.ts"
click node_storage "https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/lib/storage.ts"
click node_encryption "https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/lib/encryption.ts"
click node_queue "https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/lib/queue.ts"
click node_postgres "https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/lib/prisma.ts"

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_gpu_pipeline,node_unit_scale,node_unity_convert,node_splat_tools,node_mesh_tool,node_gpu_worker,node_unity toneBlue
class node_web_ui,node_upload_api,node_cases_api,node_jobs_api,node_asset_api,node_scene_api,node_custody_api,node_redis toneAmber
class node_custody,node_anchor,node_storage,node_encryption toneMint
class node_queue,node_postgres toneRose
class node_phone,node_investigator toneIndigo
```

## Components

### Reconstruction pipeline

- [GPU reconstruction](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/gpu/run_scene.py): `gpu/run_scene.py`
- [Compute unitScale](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/tools/compute_unitscale.py): `tools/compute_unitscale.py`
- [Unity PLY conversion](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/tools/convert_ply_to_unity.py): `tools/convert_ply_to_unity.py`
- [Splat utilities](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/tools/decimate_splats.py): `tools/decimate_splats.py`
- [Mesh conversion](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/tools/splat_to_mesh.py): `tools/splat_to_mesh.py`
- [GPU job worker](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/gpu/worker.py): `gpu/worker.py`

### Web application

- [Case and scene UI](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/app/(dashboard)/cases/%5Bid%5D/case-detail.tsx): `web/src/app/(dashboard)/cases/[id]/case-detail.tsx`
- [Upload endpoint](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/app/api/uploads/route.ts): `web/src/app/api/uploads/route.ts`
- [Case endpoints](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/app/api/cases/route.ts): `web/src/app/api/cases/route.ts`
- [Job endpoints](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/app/api/jobs/route.ts): `web/src/app/api/jobs/route.ts`
- [Scene asset endpoint](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/app/api/scenes/%5Bid%5D/asset/route.ts): `web/src/app/api/scenes/[id]/asset/route.ts`
- [Scene and anchor APIs](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/app/api/scenes/%5Bid%5D/anchor/route.ts): `web/src/app/api/scenes/[id]/anchor/route.ts`
- [Custody verification](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/app/api/custody/verify/route.ts): `web/src/app/api/custody/verify/route.ts`

### Evidence services

- [Hash-chain audit](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/lib/custody.ts): `web/src/lib/custody.ts`
- [Scene anchoring](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/lib/anchor.ts): `web/src/lib/anchor.ts`
- [Asset storage](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/lib/storage.ts): `web/src/lib/storage.ts`
- [Asset encryption](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/lib/encryption.ts): `web/src/lib/encryption.ts`

### Persistent state

- [Reconstruction queue](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/lib/queue.ts): `web/src/lib/queue.ts`
- [PostgreSQL records](https://github.com/tayyabkhalid25/recon-reconstructed-evidence-via-crime-scene-nerf/blob/main/web/src/lib/prisma.ts): `web/src/lib/prisma.ts`

### Other components

- **Capture video**
- **Investigator**
- **Unity client**
- **Redis**

## Connections

- Capture video → GPU reconstruction: processes video (evidence: `README.md`)
- GPU reconstruction → Compute unitScale: runs stage (evidence: `README.md`)
- GPU reconstruction → Unity PLY conversion: runs stage (evidence: `README.md`)
- GPU reconstruction → GPU job worker: worker launches (evidence: `gpu/worker.py`)
- Investigator → Upload endpoint: uploads capture (evidence: `web/src/app/api/uploads/route.ts`)
- Upload endpoint → PostgreSQL records: creates scene and job (evidence: `web/src/app/api/uploads/route.ts`)
- Upload endpoint → Asset storage: writes video (evidence: `web/src/app/api/uploads/route.ts`)
- Upload endpoint → Hash-chain audit: appends audit (evidence: `web/src/app/api/uploads/route.ts`)
- Upload endpoint → Reconstruction queue: enqueues job (evidence: `web/src/app/api/uploads/route.ts`)
- Reconstruction queue → Redis: stores queue job (evidence: `web/src/lib/queue.ts`)
- GPU job worker → Job endpoints: claims and reports (evidence: `gpu/worker.py`)
- GPU job worker → GPU reconstruction: runs reconstruction (evidence: `gpu/worker.py`)
- GPU job worker → Job endpoints: uploads result (evidence: `gpu/worker.py`)
- GPU job worker → PostgreSQL records: job state recorded
- Unity client → Scene asset endpoint: fetches scene asset (evidence: `README.md`)
- Scene asset endpoint → Asset storage: streams asset
- Asset storage → Asset encryption: encrypts and decrypts (evidence: `web/src/lib/storage.ts`)
- Investigator → Case endpoints: manages cases (evidence: `web/src/app/api/cases/route.ts`)
- Case endpoints → PostgreSQL records: reads and creates (evidence: `web/src/app/api/cases/route.ts`)
- Case endpoints → Hash-chain audit: audits case creation (evidence: `web/src/app/api/cases/route.ts`)
- Custody verification → Hash-chain audit: verifies chain
- Scene and anchor APIs → Scene anchoring: handles transforms
- Case and scene UI → Investigator: presents case details
- Splat utilities → GPU reconstruction: post-processes output (evidence: `README.md`)
- Mesh conversion → GPU reconstruction: creates collider mesh (evidence: `README.md`)
