# VDVC — Valsts dokumentu vadības klasifikators
**VARAM Dokumentu vadības klasifikācijas shēma** — machine-readable classification schema for the DVS Namejs document management system.
## Overview
This package transforms VARAM's Excel-based document classification schema (647 entries) into a structured, machine-readable format. It provides two variants:
| | V1 (as-is) | V2 (proposed) |
|---|---|---|
| **Approach** | 1:1 from Excel, normalised | Functional restructuring per MK Nr. 282 §33 |
| **Categories** | 493 leaf categories | 181 (132 + 45 + 4) |
| **I2 projects** | 33 groups × 4 sub-cats = 132 | 4 functional + 33 project tags |
| **I1 programmes** | 13 groups × ~17 sub-cats = 227 | 45 functional + 13 programme tags |
| **Correspondence** | 9 audience sub-categories | 1 category + 9 audience tags |
| **Retention** | 50+ free-text variants | 5 structured types + conditional rules |
| **Numbering** | P-1-13-4, I1-1-1.2, Il-9-2 | 1.1.13, 2.1.2, 3.1 (clean numeric) |
| **MCP served** | No | Yes |
## Files
```
├── vdvc-classification.xsd XSD schema (both V1 and V2)
├── classification-v1-asis.xml V1: 493 categories, original structure
├── classification-v2-proposed.xml V2: 181 categories, functional
├── vocabularies.xml Controlled vocabularies (depts, programmes, projects, audiences)
├── migration-mapping.csv V1→V2 lookup table (355 rows)
├── mcp-config.yaml MCP server configuration (V2 only)
├── index.html GUI editor (display V1, edit V2)
└── README.md This file
```
## Design Decisions
### Q1: Metadata Identifiers
- **Q1a**: Programme codes use internal IDs (`PRG-001`..`PRG-013`), not EU codes
- **Q1b**: Project codes use internal IDs (`PRJ-001`..`PRJ-033`), not EU project numbers
- **Q1c**: Department codes (e.g. `IPD`, `LN`) are in the vocabulary file, with cross-reference placeholder to VARAM Organizations Register
### Q2: V1 Normalisation
- **Q2a**: Mixed separators normalised (dots→hyphens: `P-1-18.1` → `P-1-18-1`). `Il` typo → `I1`.
- **Q2b**: 93 NBSP retention values treated as empty (element omitted)
### Q3: V2 Restructuring
- **Q3a**: P-1-13 correspondence collapsed to one category (`1.1.13`) with `retentionRule` elements per audience. Different retention terms preserved as conditional rules.
- **Q3b**: I1/I2 retention always on category+programme/project combination. Default retention on category, overrides via `retentionRule`.
- **Q3c**: Clean numeric domains: `1` (Pārvalde), `2` (Programmu vadība), `3` (Projektu ieviešana). Dot separators: `1.1.13`, `2.3.1`, `3.2`.
### Q4: GUI
- **Q4a**: Display V1 (read-only), edit V2
- **Q4b**: Download XML for manual commit (MVP)
### Q5: MCP
- **Q5a**: V2 only
- **Q5b**: Clean normalised structure in `generate_document`
## Retention Normalisation
50+ free-text variants → 5 structured XML types:
| Type | XML Element | Example Original |
|------|-------------|-----------------|
| Permanent | `` | "Pastāvīgi", "Patstāvīgi" |
| Duration | `` | "5 gadi" |
| Triggered duration | `` | "5 gadi pēc projekta noslēguma pārskata apstiprināšanas" |
| Fixed date | `2034-12-31` | "31.12.2034.", "2031-12-31" |
| Fixed date (EU) | `2032-12-31` | "31.12.2032. EK" |
Additional special types: ``, ``.
Trigger types: `creation`, `project_closure`, `programme_closure`, `contract_end`, `employment_end`, `replacement`, `assessment`, `last_debt_cleared`, `description_complete`, `procurement_execution`, `procurement_signing`, `disciplinary_decision`.
## V2 Conditional Retention (retentionRule)
When a category's retention depends on metadata (audience, programme, project), V2 uses `retentionRule` elements:
```xml
Korespondence
PRJ-002
2034-04-30
```
Resolution order: specific project/programme/audience rule → default retention.
## Namespace
```
urn:vdvc:classification:2026
```
Prefix: `vdvc:`
## Legal Basis
- **MK noteikumi Nr. 282** (20.04.2012.) — "Noteikumi par dokumentu izstrādāšanu un noformēšanu" §33: classification schema must be based on document functions.
- **VARAM iekšējie noteikumi** — current classification schema approved by ministry order.
## ProcessGit Repository
```
https://processgit.org/VARAM/Document_classification_schema
```
MCP endpoint auto-generated from `mcp-config.yaml`.
## Migration from V1 to V2
Use `migration-mapping.csv` for automated document re-classification:
```csv
v1_code,v1_name,v2_code,v2_name,tag_type,tag_id,notes
I2-2-1,"Korespondence",3.1,Korespondence,project,PRJ-002,
I2-2-2,"Līgumi...",3.2,Līgumi un akti,project,PRJ-002,
P-1-13-1,"Sarakste ar republikas...",1.1.13,Sarakste,audience,republic-orgs,conditional retention
```
Migration steps:
1. Look up `v1_code` in CSV
2. Assign `v2_code` as new classification
3. Add `tag_type`:`tag_id` as document metadata
4. Resolve retention from V2 category + tag combination