# iamezaz/aml architecture

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

- Interactive diagram: https://gitdiagram.com/iamezaz/aml
- Repository: https://github.com/iamezaz/aml

## Overview

This Laravel application screens submitted names against imported UN sanctions records and provides an authenticated admin interface for importing XML, browsing records, and deleting imported files. The principal flow is a screening request routed to the controller, fuzzy matching against stored entities, and JSON results; the admin upload flow parses XML and persists entities plus aliases and documents. Source excerpts show these service calls and model relationships; unsampled routes and views are included only where the README or source index supports their role.

Main entry points: [`app/Http/Controllers/AmlScreeningController.php`](https://github.com/iamezaz/aml/blob/main/app/Http/Controllers/AmlScreeningController.php) (Screening controller), [`app/Models/AmlIndividual.php`](https://github.com/iamezaz/aml/blob/main/app/Models/AmlIndividual.php) (Sanctioned individuals), [`routes/web.php`](https://github.com/iamezaz/aml/blob/main/routes/web.php) (Web routes), [`app/Services/AmlXmlParserService.php`](https://github.com/iamezaz/aml/blob/main/app/Services/AmlXmlParserService.php) (XML parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web and access"]
  node_web_routes["Web routes<br/>[web.php]"]
  node_aml_controller["Screening controller"]
  node_auth_controller["Authentication controller<br/>[AuthController.php]"]
  node_admin_middleware["Admin middleware<br/>[IsAdmin.php]"]
  node_public_view["Public screening UI<br/>[public.blade.php]"]
  node_admin_view["Admin dashboard UI<br/>[admin.blade.php]"]
  node_login_view["Login UI<br/>[login.blade.php]"]
  node_user_model["Admin user model<br/>[User.php]"]
  node_base_controller["Controller base<br/>[Controller.php]"]
  node_provider["Application provider"]
end

subgraph group_screening["Screening"]
  node_matcher["Fuzzy matching"]
end

subgraph group_imports["List imports"]
  node_parser["XML parser"]
end

subgraph group_records["Sanctions records"]
  node_aml_file["Import file record<br/>[AmlFile.php]"]
  node_individual["Sanctioned individuals<br/>[AmlIndividual.php]"]
  node_alias["Name aliases<br/>[AmlAlias.php]"]
  node_document["Identity documents<br/>[AmlDocument.php]"]
  node_database[("Application database")]
end

node_visitor(("Public user"))
node_administrator(("Administrator"))

node_visitor -->|"opens screening"| node_web_routes
node_administrator -->|"uses admin"| node_web_routes
node_web_routes -->|"routes requests"| node_aml_controller
node_web_routes -->|"routes auth"| node_auth_controller
node_aml_controller -->|"screens names"| node_matcher
node_matcher -->|"queries candidates"| node_individual
node_aml_controller -->|"parses uploads"| node_parser
node_parser -->|"normalizes names"| node_matcher
node_parser -->|"upserts records"| node_individual
node_parser -->|"syncs aliases"| node_alias
node_parser -->|"syncs documents"| node_document
node_aml_controller -->|"creates and deletes"| node_aml_file
node_aml_controller -->|"loads admin records"| node_individual
node_individual -.->|"persists entity"| node_database
node_alias -->|"belongs to"| node_individual
node_document -->|"belongs to"| node_individual
node_aml_file -->|"owns imported records"| node_individual
node_aml_controller -->|"renders screening"| node_public_view
node_aml_controller -->|"renders dashboard"| node_admin_view
node_auth_controller -->|"renders login"| node_login_view
node_aml_controller -->|"extends"| node_base_controller
node_auth_controller -->|"extends"| node_base_controller
node_web_routes -.->|"protects admin"| node_admin_middleware
node_provider -.->|"configures pagination"| node_web_routes
node_auth_controller -.->|"authenticates users"| node_user_model

click node_web_routes "https://github.com/iamezaz/aml/blob/main/routes/web.php"
click node_aml_controller "https://github.com/iamezaz/aml/blob/main/app/Http/Controllers/AmlScreeningController.php"
click node_auth_controller "https://github.com/iamezaz/aml/blob/main/app/Http/Controllers/AuthController.php"
click node_admin_middleware "https://github.com/iamezaz/aml/blob/main/app/Http/Middleware/IsAdmin.php"
click node_public_view "https://github.com/iamezaz/aml/blob/main/resources/views/aml/public.blade.php"
click node_admin_view "https://github.com/iamezaz/aml/blob/main/resources/views/aml/admin.blade.php"
click node_login_view "https://github.com/iamezaz/aml/blob/main/resources/views/auth/login.blade.php"
click node_matcher "https://github.com/iamezaz/aml/blob/main/app/Services/AmlMatchingService.php"
click node_parser "https://github.com/iamezaz/aml/blob/main/app/Services/AmlXmlParserService.php"
click node_aml_file "https://github.com/iamezaz/aml/blob/main/app/Models/AmlFile.php"
click node_individual "https://github.com/iamezaz/aml/blob/main/app/Models/AmlIndividual.php"
click node_alias "https://github.com/iamezaz/aml/blob/main/app/Models/AmlAlias.php"
click node_document "https://github.com/iamezaz/aml/blob/main/app/Models/AmlDocument.php"
click node_user_model "https://github.com/iamezaz/aml/blob/main/app/Models/User.php"
click node_base_controller "https://github.com/iamezaz/aml/blob/main/app/Http/Controllers/Controller.php"
click node_provider "https://github.com/iamezaz/aml/blob/main/app/Providers/AppServiceProvider.php"
click node_database "https://github.com/iamezaz/aml/tree/main/database/migrations"

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_web_routes,node_aml_controller,node_auth_controller,node_admin_middleware,node_public_view,node_admin_view,node_login_view,node_user_model,node_base_controller,node_provider,node_visitor toneBlue
class node_matcher toneAmber
class node_parser toneMint
class node_aml_file,node_individual,node_alias,node_document,node_database toneRose
class node_administrator toneIndigo
```

## Components

### Web and access

- [Web routes](https://github.com/iamezaz/aml/blob/main/routes/web.php): `routes/web.php`
- [Screening controller](https://github.com/iamezaz/aml/blob/main/app/Http/Controllers/AmlScreeningController.php): `app/Http/Controllers/AmlScreeningController.php`
- [Authentication controller](https://github.com/iamezaz/aml/blob/main/app/Http/Controllers/AuthController.php): `app/Http/Controllers/AuthController.php`
- [Admin middleware](https://github.com/iamezaz/aml/blob/main/app/Http/Middleware/IsAdmin.php): `app/Http/Middleware/IsAdmin.php`
- [Public screening UI](https://github.com/iamezaz/aml/blob/main/resources/views/aml/public.blade.php): `resources/views/aml/public.blade.php`
- [Admin dashboard UI](https://github.com/iamezaz/aml/blob/main/resources/views/aml/admin.blade.php): `resources/views/aml/admin.blade.php`
- [Login UI](https://github.com/iamezaz/aml/blob/main/resources/views/auth/login.blade.php): `resources/views/auth/login.blade.php`
- [Admin user model](https://github.com/iamezaz/aml/blob/main/app/Models/User.php): `app/Models/User.php`
- [Controller base](https://github.com/iamezaz/aml/blob/main/app/Http/Controllers/Controller.php): `app/Http/Controllers/Controller.php`
- [Application provider](https://github.com/iamezaz/aml/blob/main/app/Providers/AppServiceProvider.php): `app/Providers/AppServiceProvider.php`

### Screening

- [Fuzzy matching](https://github.com/iamezaz/aml/blob/main/app/Services/AmlMatchingService.php): `app/Services/AmlMatchingService.php`

### List imports

- [XML parser](https://github.com/iamezaz/aml/blob/main/app/Services/AmlXmlParserService.php): `app/Services/AmlXmlParserService.php`

### Sanctions records

- [Import file record](https://github.com/iamezaz/aml/blob/main/app/Models/AmlFile.php): `app/Models/AmlFile.php`
- [Sanctioned individuals](https://github.com/iamezaz/aml/blob/main/app/Models/AmlIndividual.php): `app/Models/AmlIndividual.php`
- [Name aliases](https://github.com/iamezaz/aml/blob/main/app/Models/AmlAlias.php): `app/Models/AmlAlias.php`
- [Identity documents](https://github.com/iamezaz/aml/blob/main/app/Models/AmlDocument.php): `app/Models/AmlDocument.php`
- [Application database](https://github.com/iamezaz/aml/tree/main/database/migrations): `database/migrations`

### Other components

- **Public user**
- **Administrator**

## Connections

- Public user → Web routes: opens screening (evidence: `README.md`)
- Administrator → Web routes: uses admin (evidence: `README.md`)
- Web routes → Screening controller: routes requests (evidence: `routes/web.php`)
- Web routes → Authentication controller: routes auth (evidence: `routes/web.php`)
- Screening controller → Fuzzy matching: screens names (evidence: `app/Http/Controllers/AmlScreeningController.php`)
- Fuzzy matching → Sanctioned individuals: queries candidates (evidence: `app/Services/AmlMatchingService.php`)
- Screening controller → XML parser: parses uploads (evidence: `app/Http/Controllers/AmlScreeningController.php`)
- XML parser → Fuzzy matching: normalizes names (evidence: `app/Services/AmlXmlParserService.php`)
- XML parser → Sanctioned individuals: upserts records (evidence: `app/Services/AmlXmlParserService.php`)
- XML parser → Name aliases: syncs aliases (evidence: `app/Services/AmlXmlParserService.php`)
- XML parser → Identity documents: syncs documents (evidence: `app/Services/AmlXmlParserService.php`)
- Screening controller → Import file record: creates and deletes (evidence: `app/Http/Controllers/AmlScreeningController.php`)
- Screening controller → Sanctioned individuals: loads admin records (evidence: `app/Http/Controllers/AmlScreeningController.php`)
- Sanctioned individuals → Application database: persists entity
- Name aliases → Sanctioned individuals: belongs to (evidence: `app/Models/AmlAlias.php`)
- Identity documents → Sanctioned individuals: belongs to (evidence: `app/Models/AmlDocument.php`)
- Import file record → Sanctioned individuals: owns imported records (evidence: `app/Models/AmlFile.php`)
- Screening controller → Public screening UI: renders screening (evidence: `app/Http/Controllers/AmlScreeningController.php`)
- Screening controller → Admin dashboard UI: renders dashboard (evidence: `app/Http/Controllers/AmlScreeningController.php`)
- Authentication controller → Login UI: renders login (evidence: `app/Http/Controllers/AuthController.php`)
- Screening controller → Controller base: extends (evidence: `app/Http/Controllers/AmlScreeningController.php`)
- Authentication controller → Controller base: extends (evidence: `app/Http/Controllers/AuthController.php`)
- Web routes → Admin middleware: protects admin
- Application provider → Web routes: configures pagination
- Authentication controller → Admin user model: authenticates users
