You've already forked iesnieguma-izskatisana
Import UAPF package
init
This commit is contained in:
163
README.md
163
README.md
@@ -0,0 +1,163 @@
|
||||
# Tiesībsarga biroja iesnieguma izskatīšanas process
|
||||
|
||||
UAPF package: `lv.tiesibsargs.iesnieguma-izskatisana@0.1.0`
|
||||
|
||||
An algorithmated complaint-intake and triage process for the Office of the Ombudsman of Latvia (Tiesībsarga birojs). Fetches an incoming citizen complaint (iesniegums), redacts PII before AI processing, extracts structured facts with an AI capability, runs three deterministic DMN decisions to classify the topic / determine priority / route to the appropriate department, persists the classification record, and emits a domain event. Human assignment, response drafting, and case closure remain in the host document management system.
|
||||
|
||||
This package is the worked example for the AI-Assisted Case Management profile of [UAPF-IP v0.1](https://github.com/UAPFormat/UAPF-IP).
|
||||
|
||||
## Scope and constraints
|
||||
|
||||
This package conforms to the UAPF-IP v0.1 *Orchestrated Process* profile and the v0.1 reference engine's BPMN walker — which means **linear flows only**, no gateways, no user tasks inside the process itself. The deliberate consequence: the UAPF process produces a *recommendation* (classification + priority + routing); the actual human assignment and response work happens in OpenDMS workflows outside the UAPF execution boundary. This is the right shape for a v0.1 demo and the right separation of concerns regardless — UAPF holds the algorithm; the DMS holds the human workflow.
|
||||
|
||||
## Flow
|
||||
|
||||
```
|
||||
Start
|
||||
└─> [service] document.fetch — retrieve the iesniegums from the DMS
|
||||
└─> [service] ai.redact — strip PII before any AI invocation
|
||||
└─> [service] ai.extract — produce structured facets per the guardrails-allowed schema
|
||||
└─> [rules] classify-topic — DMN: facets → canonical topic
|
||||
└─> [rules] determine-priority — DMN: topic + indicators → priority + SLA
|
||||
└─> [rules] route-to-department — DMN: topic → department + reviewer role
|
||||
└─> [service] data.write — persist the classification record
|
||||
└─> [service] event.emit — publish "iesniegums.classified"
|
||||
└─> End
|
||||
```
|
||||
|
||||
Nine sequence flows, ten nodes, linear. Three service tasks invoke host capabilities. Three business-rule tasks invoke embedded DMN. Two final service tasks record and emit.
|
||||
|
||||
## Capabilities required
|
||||
|
||||
The host must implement at least these to load and execute this package:
|
||||
|
||||
| Capability | Used at | Purpose |
|
||||
|---|---|---|
|
||||
| `document.fetch@1+` | step `FetchDocument` | Return the iesniegums body + metadata by DID |
|
||||
| `ai.redact@1+` | step `RedactPii` | Detect and redact personas_kods, addresses, names, financial, health |
|
||||
| `ai.extract@1+` | step `ExtractFacets` | Return the boolean facet schema below |
|
||||
| `data.write@1+` | step `RecordClassification` | Persist the classification + routing record |
|
||||
| `event.emit@1+` | step `EmitClassifiedEvent` | Publish "iesniegums.classified" to the host's event bus |
|
||||
|
||||
## Facet schema (what ai.extract must return)
|
||||
|
||||
```json
|
||||
{
|
||||
"mentionsChildren": true,
|
||||
"mentionsDiscrimination": false,
|
||||
"mentionsPrisons": false,
|
||||
"mentionsPolice": false,
|
||||
"mentionsHealth": false,
|
||||
"mentionsSocialServices": true,
|
||||
"mentionsPrivacy": false,
|
||||
"mentionsPublicAdministration": false,
|
||||
"vulnerablePerson": true,
|
||||
"urgency": false,
|
||||
"ongoingHarm": false,
|
||||
"languageDetected": "lv"
|
||||
}
|
||||
```
|
||||
|
||||
The DMN tables consume those booleans plus a `topic` string flowing between them. Output schema after the full process completes:
|
||||
|
||||
```json
|
||||
{
|
||||
"topic": "child-rights",
|
||||
"topicConfidence": 0.92,
|
||||
"priority": "high",
|
||||
"slaHours": 168,
|
||||
"department": "Bērna tiesību nodaļa",
|
||||
"reviewerRole": "berna-tiesibu-jurists"
|
||||
}
|
||||
```
|
||||
|
||||
## Guardrails
|
||||
|
||||
See [`resources/guardrails.yaml`](./resources/guardrails.yaml). Highlights:
|
||||
|
||||
- AI is **advisory only**. `decisions_ai_may_make_unattended` is empty by design.
|
||||
- PII redaction is required before any AI invocation. `personas_kods`, bank accounts, exact addresses, children's names, and health record numbers are forbidden from AI input.
|
||||
- Allowed models: Claude Opus 4.7, Claude Sonnet 4.6 (Extended Thinking).
|
||||
- Human oversight required for final classification acceptance, response dispatch, and case closure.
|
||||
- Audit retention: 10 years for the VC chain, 2 years for AI invocation logs.
|
||||
|
||||
## Files
|
||||
|
||||
```
|
||||
lv.tiesibsargs.iesnieguma-izskatisana/
|
||||
├── manifest.json
|
||||
├── README.md (this file)
|
||||
├── bpmn/
|
||||
│ └── iesnieguma-izskatisana.bpmn.xml Process flow (linear, 10 nodes)
|
||||
├── dmn/
|
||||
│ ├── classify-topic.dmn.xml 9 rules, FIRST hit policy
|
||||
│ ├── determine-priority.dmn.xml 6 rules, FIRST hit policy
|
||||
│ └── route-to-department.dmn.xml 9 rules, UNIQUE hit policy
|
||||
├── resources/
|
||||
│ ├── guardrails.yaml Policy snapshot for session
|
||||
│ ├── tiesibsargs-taxonomy.yaml Canonical topic list + legal anchors
|
||||
│ └── department-roster.yaml Department-to-topic-to-role mapping
|
||||
├── fixtures/
|
||||
│ ├── sample-good-governance-complaint.json
|
||||
│ ├── sample-child-rights-complaint.json
|
||||
│ └── sample-discrimination-complaint.json
|
||||
├── tests/
|
||||
│ └── expected-classifications.json Expected DMN outputs per fixture
|
||||
└── docs/
|
||||
├── 00-overview.md
|
||||
├── 01-legal-basis.md
|
||||
└── 02-ai-act-classification.md
|
||||
```
|
||||
|
||||
## Building and loading
|
||||
|
||||
```bash
|
||||
# Package as a UAPF zip
|
||||
cd lv.tiesibsargs.iesnieguma-izskatisana
|
||||
zip -r ../lv.tiesibsargs.iesnieguma-izskatisana-0.1.0.uapf .
|
||||
|
||||
# Drop into a uapf-engine packages directory
|
||||
cp lv.tiesibsargs.iesnieguma-izskatisana-0.1.0.uapf /path/to/uapf-engine/packages/
|
||||
|
||||
# Or push to ProcessGit for governed distribution
|
||||
git push https://USER:TOKEN@processgit.org/Tiesibsargs/iesnieguma-izskatisana.git main
|
||||
```
|
||||
|
||||
## Running against the engine
|
||||
|
||||
Once loaded into a `uapf-engine` instance and a UAPF-IP-conformant host is reachable, invoke with:
|
||||
|
||||
```bash
|
||||
curl -X POST http://uapf-engine:4000/uapf/start-session \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"packageId": "lv.tiesibsargs.iesnieguma-izskatisana",
|
||||
"packageVersion": "0.1.0",
|
||||
"processId": "iesnieguma-izskatisana",
|
||||
"input": {
|
||||
"documentDid": "did:doc:tiesibsargs:2026-0518"
|
||||
},
|
||||
"hostManifest": {
|
||||
"hostDid": "did:web:tiesibsargs.opendms.dev",
|
||||
"hostBaseUrl": "https://tiesibsargs.opendms.dev",
|
||||
"profiles": ["uapf-ip-orchestrated"],
|
||||
"capabilities": [
|
||||
{ "namespace": "document", "operation": "fetch", "version": 1 },
|
||||
{ "namespace": "ai", "operation": "redact", "version": 1 },
|
||||
{ "namespace": "ai", "operation": "extract","version": 1 },
|
||||
{ "namespace": "data", "operation": "write", "version": 1 },
|
||||
{ "namespace": "event", "operation": "emit", "version": 1 }
|
||||
]
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
## Status
|
||||
|
||||
- v0.1 draft. Ready for first integration against OpenDMS under the MIC AI regulatory sandbox.
|
||||
- DMN tables hand-tuned from the Tiesībsarga 2025 annual report category distribution; should be refined with real complaint data once the sandbox protocol allows.
|
||||
- The `ai.extract` facet schema is the spot most likely to evolve. Treat it as a contract between this package and whatever AI model serves the capability.
|
||||
|
||||
## License
|
||||
|
||||
MIT.
|
||||
|
||||
Reference in New Issue
Block a user