# splaika/ctn-prototype architecture

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

- Interactive diagram: https://gitdiagram.com/splaika/ctn-prototype
- Repository: https://github.com/splaika/ctn-prototype

## Overview

CTN Suite is a SharePoint-hosted clinical-trial-notification workflow for drafting, reviewing, approving, submitting, and generating CTN XML. The SPFx web part selects the data source and user role, then hosts the application; the repository persists notification and master data in SharePoint lists. The README also documents setup, role-based access, and the shared UI/domain-logic source. Several domain modules are unsampled, so their links are shown only where documented; the graph omits uncertain implementation details.

Main entry points: [`ctn-spfx/src/webparts/ctnSuite/CtnApp.tsx`](https://github.com/splaika/ctn-prototype/blob/main/ctn-spfx/src/webparts/ctnSuite/CtnApp.tsx) (Workflow app), [`ctn-spfx/src/webparts/ctnSuite/CtnSuiteWebPart.ts`](https://github.com/splaika/ctn-prototype/blob/main/ctn-spfx/src/webparts/ctnSuite/CtnSuiteWebPart.ts) (SPFx host), [`ctn-spfx/src/data/sharepointRepository.ts`](https://github.com/splaika/ctn-prototype/blob/main/ctn-spfx/src/data/sharepointRepository.ts) (SharePoint repository), [`ctn-spfx/src/data/spClient.ts`](https://github.com/splaika/ctn-prototype/blob/main/ctn-spfx/src/data/spClient.ts) (SharePoint REST client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_host["SharePoint host"]
  node_webpart["SPFx host<br/>[CtnSuiteWebPart.ts]"]
  node_setupview["Setup screen<br/>[SetupView.tsx]"]
  node_hoststyles["Host styles<br/>[hostStyles.ts]"]
end

subgraph group_workflow["CTN workflow"]
  node_app["Workflow app<br/>[CtnApp.tsx]"]
  node_author["Notification authoring<br/>[CreateWizard.tsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_notificationlist["Notification list"]
  node_review["Review and approval"]
  node_import["PDF import<br/>[ImportView.tsx]"]
end

subgraph group_domain["Domain services"]
  node_xml["CTN XML output<br/>[xml.ts]"]
  node_logic["CTN rules<br/>[logic.ts]"]
  node_permissions["Role permissions<br/>[permissions.ts]"]
end

subgraph group_data["Persistence and setup"]
  node_role["Role resolver<br/>[roleResolver.ts]"]
  node_repo["SharePoint repository"]
  node_rest["SharePoint REST client<br/>[spClient.ts]"]
  node_provision["List provisioning<br/>[listProvisioner.ts]"]
  node_sharepoint[("SharePoint lists")]
  node_fakeclient["In-memory client<br/>[fakeSpClient.ts]"]
end

node_user(("CTN users"))

node_user -->|"uses"| node_webpart
node_webpart -->|"hosts"| node_app
node_webpart -->|"injects"| node_repo
node_webpart -->|"resolves role"| node_role
node_webpart -->|"shows setup"| node_setupview
node_webpart -->|"applies styles"| node_hoststyles
node_setupview -->|"starts setup"| node_provision
node_provision -->|"creates lists"| node_sharepoint
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_notificationlist
node_app -->|"renders"| node_import
node_app -->|"supports drafting"| node_author
node_app -->|"supports workflow"| node_review
node_app -->|"loads and saves"| node_repo
node_repo -->|"calls"| node_rest
node_rest -->|"reads and writes"| node_sharepoint
node_repo -->|"normalizes data"| node_logic
node_repo -->|"checks access"| node_permissions
node_role -->|"maps roles"| node_permissions
node_app -->|"generates XML"| node_xml
node_fakeclient -->|"implements interface"| node_rest

click node_webpart "https://github.com/splaika/ctn-prototype/blob/main/ctn-spfx/src/webparts/ctnSuite/CtnSuiteWebPart.ts"
click node_app "https://github.com/splaika/ctn-prototype/blob/main/ctn-spfx/src/webparts/ctnSuite/CtnApp.tsx"
click node_setupview "https://github.com/splaika/ctn-prototype/blob/main/ctn-spfx/src/webparts/ctnSuite/SetupView.tsx"
click node_author "https://github.com/splaika/ctn-prototype/blob/main/demo/app/src/ctn/components/CreateWizard.tsx"
click node_dashboard "https://github.com/splaika/ctn-prototype/blob/main/demo/app/src/ctn/components/Dashboard.tsx"
click node_notificationlist "https://github.com/splaika/ctn-prototype/blob/main/demo/app/src/ctn/components/NotificationList.tsx"
click node_review "https://github.com/splaika/ctn-prototype/blob/main/demo/app/src/ctn/components/NotificationDetail.tsx"
click node_import "https://github.com/splaika/ctn-prototype/blob/main/demo/app/src/ctn/components/ImportView.tsx"
click node_xml "https://github.com/splaika/ctn-prototype/blob/main/demo/app/src/ctn/xml.ts"
click node_logic "https://github.com/splaika/ctn-prototype/blob/main/demo/app/src/ctn/logic.ts"
click node_permissions "https://github.com/splaika/ctn-prototype/blob/main/demo/app/src/ctn/permissions.ts"
click node_role "https://github.com/splaika/ctn-prototype/blob/main/ctn-spfx/src/data/roleResolver.ts"
click node_repo "https://github.com/splaika/ctn-prototype/blob/main/ctn-spfx/src/data/sharepointRepository.ts"
click node_rest "https://github.com/splaika/ctn-prototype/blob/main/ctn-spfx/src/data/spClient.ts"
click node_provision "https://github.com/splaika/ctn-prototype/blob/main/ctn-spfx/src/data/listProvisioner.ts"
click node_fakeclient "https://github.com/splaika/ctn-prototype/blob/main/ctn-spfx/src/data/fakeSpClient.ts"
click node_hoststyles "https://github.com/splaika/ctn-prototype/blob/main/ctn-spfx/src/webparts/ctnSuite/hostStyles.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_webpart,node_setupview,node_hoststyles,node_user toneBlue
class node_app,node_author,node_dashboard,node_notificationlist,node_review,node_import toneAmber
class node_xml,node_logic,node_permissions toneMint
class node_role,node_repo,node_rest,node_provision,node_sharepoint,node_fakeclient toneRose
```

## Components

### SharePoint host

- [SPFx host](https://github.com/splaika/ctn-prototype/blob/main/ctn-spfx/src/webparts/ctnSuite/CtnSuiteWebPart.ts): `ctn-spfx/src/webparts/ctnSuite/CtnSuiteWebPart.ts`
- [Setup screen](https://github.com/splaika/ctn-prototype/blob/main/ctn-spfx/src/webparts/ctnSuite/SetupView.tsx): `ctn-spfx/src/webparts/ctnSuite/SetupView.tsx`
- [Host styles](https://github.com/splaika/ctn-prototype/blob/main/ctn-spfx/src/webparts/ctnSuite/hostStyles.ts): `ctn-spfx/src/webparts/ctnSuite/hostStyles.ts`

### CTN workflow

- [Workflow app](https://github.com/splaika/ctn-prototype/blob/main/ctn-spfx/src/webparts/ctnSuite/CtnApp.tsx): `ctn-spfx/src/webparts/ctnSuite/CtnApp.tsx`
- [Notification authoring](https://github.com/splaika/ctn-prototype/blob/main/demo/app/src/ctn/components/CreateWizard.tsx): `demo/app/src/ctn/components/CreateWizard.tsx`
- [Dashboard](https://github.com/splaika/ctn-prototype/blob/main/demo/app/src/ctn/components/Dashboard.tsx): `demo/app/src/ctn/components/Dashboard.tsx`
- [Notification list](https://github.com/splaika/ctn-prototype/blob/main/demo/app/src/ctn/components/NotificationList.tsx): `demo/app/src/ctn/components/NotificationList.tsx`
- [Review and approval](https://github.com/splaika/ctn-prototype/blob/main/demo/app/src/ctn/components/NotificationDetail.tsx): `demo/app/src/ctn/components/NotificationDetail.tsx`
- [PDF import](https://github.com/splaika/ctn-prototype/blob/main/demo/app/src/ctn/components/ImportView.tsx): `demo/app/src/ctn/components/ImportView.tsx`

### Domain services

- [CTN XML output](https://github.com/splaika/ctn-prototype/blob/main/demo/app/src/ctn/xml.ts): `demo/app/src/ctn/xml.ts`
- [CTN rules](https://github.com/splaika/ctn-prototype/blob/main/demo/app/src/ctn/logic.ts): `demo/app/src/ctn/logic.ts`
- [Role permissions](https://github.com/splaika/ctn-prototype/blob/main/demo/app/src/ctn/permissions.ts): `demo/app/src/ctn/permissions.ts`

### Persistence and setup

- [Role resolver](https://github.com/splaika/ctn-prototype/blob/main/ctn-spfx/src/data/roleResolver.ts): `ctn-spfx/src/data/roleResolver.ts`
- [SharePoint repository](https://github.com/splaika/ctn-prototype/blob/main/ctn-spfx/src/data/sharepointRepository.ts): `ctn-spfx/src/data/sharepointRepository.ts`
- [SharePoint REST client](https://github.com/splaika/ctn-prototype/blob/main/ctn-spfx/src/data/spClient.ts): `ctn-spfx/src/data/spClient.ts`
- [List provisioning](https://github.com/splaika/ctn-prototype/blob/main/ctn-spfx/src/data/listProvisioner.ts): `ctn-spfx/src/data/listProvisioner.ts`
- **SharePoint lists**
- [In-memory client](https://github.com/splaika/ctn-prototype/blob/main/ctn-spfx/src/data/fakeSpClient.ts): `ctn-spfx/src/data/fakeSpClient.ts`

### Other components

- **CTN users**

## Connections

- CTN users → SPFx host: uses (evidence: `README.md`)
- SPFx host → Workflow app: hosts (evidence: `ctn-spfx/src/webparts/ctnSuite/CtnSuiteWebPart.ts`)
- SPFx host → SharePoint repository: injects (evidence: `ctn-spfx/src/webparts/ctnSuite/CtnSuiteWebPart.ts`)
- SPFx host → Role resolver: resolves role (evidence: `ctn-spfx/src/webparts/ctnSuite/CtnSuiteWebPart.ts`)
- SPFx host → Setup screen: shows setup (evidence: `ctn-spfx/src/webparts/ctnSuite/CtnSuiteWebPart.ts`)
- SPFx host → Host styles: applies styles (evidence: `ctn-spfx/src/webparts/ctnSuite/CtnSuiteWebPart.ts`)
- Setup screen → List provisioning: starts setup (evidence: `ctn-spfx/src/webparts/ctnSuite/SetupView.tsx`)
- List provisioning → SharePoint lists: creates lists (evidence: `ctn-spfx/src/data/listProvisioner.ts`)
- Workflow app → Dashboard: renders (evidence: `ctn-spfx/src/webparts/ctnSuite/CtnApp.tsx`)
- Workflow app → Notification list: renders (evidence: `ctn-spfx/src/webparts/ctnSuite/CtnApp.tsx`)
- Workflow app → PDF import: renders (evidence: `ctn-spfx/src/webparts/ctnSuite/CtnApp.tsx`)
- Workflow app → Notification authoring: supports drafting (evidence: `README.md`)
- Workflow app → Review and approval: supports workflow (evidence: `README.md`)
- Workflow app → SharePoint repository: loads and saves (evidence: `ctn-spfx/src/webparts/ctnSuite/CtnApp.tsx`)
- SharePoint repository → SharePoint REST client: calls (evidence: `ctn-spfx/src/data/sharepointRepository.ts`)
- SharePoint REST client → SharePoint lists: reads and writes (evidence: `ctn-spfx/src/data/spClient.ts`)
- SharePoint repository → CTN rules: normalizes data (evidence: `ctn-spfx/src/data/sharepointRepository.ts`)
- SharePoint repository → Role permissions: checks access (evidence: `ctn-spfx/src/data/sharepointRepository.ts`)
- Role resolver → Role permissions: maps roles (evidence: `ctn-spfx/src/data/roleResolver.ts`)
- Workflow app → CTN XML output: generates XML (evidence: `README.md`)
- In-memory client → SharePoint REST client: implements interface (evidence: `ctn-spfx/src/data/fakeSpClient.ts`)
