# planning-inspectorate/identify-consultees architecture

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

- Interactive diagram: https://gitdiagram.com/planning-inspectorate/identify-consultees
- Repository: https://github.com/planning-inspectorate/identify-consultees

## Overview

Identify consultees screens a project boundary against consultee areas, then lets users review, adjust and export the resulting consultation report. The web app handles case boundaries, ruleset runs, report preparation, maps and administration; a Python Azure Function provides screening and CBOS access, while the database package supplies geospatial operations and reference-data loading. The graph emphasizes documented and excerpted relationships. Some function-to-web wiring and unsampled report/export internals are represented only where the README or source index supports them.

Main entry points: [`apps/manage/src/app/views/consultees/report/controller.ts`](https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/views/consultees/report/controller.ts) (Report review), [`apps/manage/src/app/views/consultees/run-ruleset.ts`](https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/views/consultees/run-ruleset.ts) (Ruleset orchestration), [`apps/manage/src/app/views/consultees/project/controller.ts`](https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/views/consultees/project/controller.ts) (Case boundary), [`apps/function-python/function_app.py`](https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/function-python/function_app.py) (Screening function)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Manage web app"]
  node_webapp["Web routes<br/>[router.ts]"]
  node_case["Case boundary<br/>[controller.ts]"]
end

subgraph group_screen["Screening service"]
  node_run["Ruleset orchestration<br/>[run-ruleset.ts]"]
  node_python["Screening function<br/>[function_app.py]"]
  node_intersector["Intersection screening<br/>[screening.py]"]
end

subgraph group_geo["Geospatial data"]
  node_dbgeo["Geospatial queries<br/>[consultee-areas.ts]"]
  node_casegeo["Case boundary data<br/>[case-boundaries.ts]"]
  node_cbos["CBOS boundary access<br/>[boundaries.py]"]
end

subgraph group_report["Review and reporting"]
  node_report["Report review<br/>[controller.ts]"]
  node_selection["Consultee selections<br/>[urls.ts]"]
  node_nearby["Nearby consultees<br/>[nearby-nsips.ts]"]
  node_exports["Report exports<br/>[report-zip.ts]"]
  node_workbook["Workbook export<br/>[workbook.ts]"]
  node_maps["Case maps<br/>[case-geojson.ts]"]
end

subgraph group_admin["Administration"]
  node_admin["Data administration<br/>[controller.ts]"]
  node_areagroups["Area group loading"]
end

node_user(("Service user"))
node_sql[("SQL Server")]
node_blob[("Blob storage")]

node_user -->|"uses"| node_webapp
node_webapp -.->|"routes"| node_case
node_case -->|"loads boundaries"| node_casegeo
node_case -.->|"starts screening"| node_run
node_run -->|"finds nearby"| node_nearby
node_run -.->|"requests screening"| node_python
node_python -.->|"runs ruleset"| node_intersector
node_intersector -.->|"queries"| node_sql
node_dbgeo -.->|"queries"| node_sql
node_casegeo -.->|"queries"| node_sql
node_python -->|"serves boundary files"| node_cbos
node_report -->|"runs ruleset"| node_run
node_report -->|"reads selections"| node_selection
node_report -.->|"creates exports"| node_exports
node_exports -->|"includes workbook"| node_workbook
node_report -.->|"builds map data"| node_maps
node_admin -->|"loads area groups"| node_areagroups
node_admin -.->|"downloads files"| node_blob

click node_webapp "https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/router.ts"
click node_case "https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/views/consultees/project/controller.ts"
click node_run "https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/views/consultees/run-ruleset.ts"
click node_python "https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/function-python/function_app.py"
click node_intersector "https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/function-python/intersector/screening.py"
click node_dbgeo "https://github.com/planning-inspectorate/identify-consultees/blob/main/packages/database/src/geospatial/consultee-areas.ts"
click node_casegeo "https://github.com/planning-inspectorate/identify-consultees/blob/main/packages/database/src/geospatial/case-boundaries.ts"
click node_cbos "https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/function-python/cbos/boundaries.py"
click node_report "https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/views/consultees/report/controller.ts"
click node_selection "https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/views/consultees/report/urls.ts"
click node_nearby "https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/views/consultees/nearby-nsips.ts"
click node_exports "https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/views/consultees/report/export/report-zip.ts"
click node_workbook "https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/views/consultees/report/export/workbook.ts"
click node_maps "https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/maps/case-geojson.ts"
click node_admin "https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/admin/import-reference-data/controller.ts"
click node_areagroups "https://github.com/planning-inspectorate/identify-consultees/blob/main/packages/database/src/seed/consultee-area-groups.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_webapp,node_case,node_user toneBlue
class node_run,node_python,node_intersector,node_sql,node_blob toneAmber
class node_dbgeo,node_casegeo,node_cbos toneMint
class node_report,node_selection,node_nearby,node_exports,node_workbook,node_maps toneRose
class node_admin,node_areagroups toneIndigo
```

## Components

### Manage web app

- [Web routes](https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/router.ts): `apps/manage/src/app/router.ts`
- [Case boundary](https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/views/consultees/project/controller.ts): `apps/manage/src/app/views/consultees/project/controller.ts`

### Screening service

- [Ruleset orchestration](https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/views/consultees/run-ruleset.ts): `apps/manage/src/app/views/consultees/run-ruleset.ts`
- [Screening function](https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/function-python/function_app.py): `apps/function-python/function_app.py`
- [Intersection screening](https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/function-python/intersector/screening.py): `apps/function-python/intersector/screening.py`

### Geospatial data

- [Geospatial queries](https://github.com/planning-inspectorate/identify-consultees/blob/main/packages/database/src/geospatial/consultee-areas.ts): `packages/database/src/geospatial/consultee-areas.ts`
- [Case boundary data](https://github.com/planning-inspectorate/identify-consultees/blob/main/packages/database/src/geospatial/case-boundaries.ts): `packages/database/src/geospatial/case-boundaries.ts`
- [CBOS boundary access](https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/function-python/cbos/boundaries.py): `apps/function-python/cbos/boundaries.py`

### Review and reporting

- [Report review](https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/views/consultees/report/controller.ts): `apps/manage/src/app/views/consultees/report/controller.ts`
- [Consultee selections](https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/views/consultees/report/urls.ts): `apps/manage/src/app/views/consultees/report/urls.ts`
- [Nearby consultees](https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/views/consultees/nearby-nsips.ts): `apps/manage/src/app/views/consultees/nearby-nsips.ts`
- [Report exports](https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/views/consultees/report/export/report-zip.ts): `apps/manage/src/app/views/consultees/report/export/report-zip.ts`
- [Workbook export](https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/views/consultees/report/export/workbook.ts): `apps/manage/src/app/views/consultees/report/export/workbook.ts`
- [Case maps](https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/maps/case-geojson.ts): `apps/manage/src/app/maps/case-geojson.ts`

### Administration

- [Data administration](https://github.com/planning-inspectorate/identify-consultees/blob/main/apps/manage/src/app/admin/import-reference-data/controller.ts): `apps/manage/src/app/admin/import-reference-data/controller.ts`
- [Area group loading](https://github.com/planning-inspectorate/identify-consultees/blob/main/packages/database/src/seed/consultee-area-groups.ts): `packages/database/src/seed/consultee-area-groups.ts`

### Other components

- **Service user**
- **SQL Server**
- **Blob storage**

## Connections

- Service user → Web routes: uses (evidence: `README.md`)
- Web routes → Case boundary: routes
- Case boundary → Case boundary data: loads boundaries (evidence: `apps/manage/src/app/views/consultees/project/controller.ts`)
- Case boundary → Ruleset orchestration: starts screening (evidence: `apps/manage/src/app/views/consultees/project/controller.ts`)
- Ruleset orchestration → Nearby consultees: finds nearby (evidence: `apps/manage/src/app/views/consultees/run-ruleset.ts`)
- Ruleset orchestration → Screening function: requests screening
- Screening function → Intersection screening: runs ruleset (evidence: `apps/function-python/function_app.py`)
- Intersection screening → SQL Server: queries
- Geospatial queries → SQL Server: queries
- Case boundary data → SQL Server: queries
- Screening function → CBOS boundary access: serves boundary files (evidence: `apps/function-python/function_app.py`)
- Report review → Ruleset orchestration: runs ruleset (evidence: `apps/manage/src/app/views/consultees/report/controller.ts`)
- Report review → Consultee selections: reads selections (evidence: `apps/manage/src/app/views/consultees/report/controller.ts`)
- Report review → Report exports: creates exports (evidence: `apps/manage/src/app/views/consultees/report/controller.ts`)
- Report exports → Workbook export: includes workbook (evidence: `apps/manage/src/app/views/consultees/report/export/report-zip.ts`)
- Report review → Case maps: builds map data
- Data administration → Area group loading: loads area groups (evidence: `apps/manage/src/app/admin/import-reference-data/controller.ts`)
- Data administration → Blob storage: downloads files
