@docrouter/mcp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +207 -0
- package/dist/docs/knowledge_base/forms.md +724 -0
- package/dist/docs/knowledge_base/prompts.md +472 -0
- package/dist/docs/knowledge_base/schemas.md +852 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1812 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1809 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,724 @@
|
|
|
1
|
+
# DocRouter Forms Configuration Guide
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Forms in DocRouter provide a human-in-the-loop interface for verifying, editing, and completing AI-extracted data from documents. Forms use the **Form.io JSON format** to define interactive UI components with validation rules and field mappings.
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
1. [What is a Form?](#what-is-a-form)
|
|
10
|
+
2. [Form Structure](#form-structure)
|
|
11
|
+
3. [Form.io Field Types](#formio-field-types)
|
|
12
|
+
4. [Field Validation](#field-validation)
|
|
13
|
+
5. [Field Mapping](#field-mapping)
|
|
14
|
+
6. [Best Practices](#best-practices)
|
|
15
|
+
7. [API Integration](#api-integration)
|
|
16
|
+
8. [Examples](#examples)
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## What is a Form?
|
|
21
|
+
|
|
22
|
+
A form in DocRouter is an interactive UI definition that:
|
|
23
|
+
|
|
24
|
+
- Displays AI-extracted data for human review and editing
|
|
25
|
+
- Provides validation rules for data quality
|
|
26
|
+
- Maps form fields to schema fields from prompt extraction
|
|
27
|
+
- Supports workflows for document approval and processing
|
|
28
|
+
- Can be tagged to automatically present for specific document types
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Form Structure
|
|
33
|
+
|
|
34
|
+
### Basic Form Format
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"name": "Insurance Application Form",
|
|
39
|
+
"response_format": {
|
|
40
|
+
"json_formio": [
|
|
41
|
+
// Array of Form.io field definitions
|
|
42
|
+
],
|
|
43
|
+
"json_formio_mapping": {
|
|
44
|
+
// Optional field mappings to schema fields
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"tag_ids": ["tag1", "tag2"]
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Components
|
|
52
|
+
|
|
53
|
+
| Component | Type | Required | Description |
|
|
54
|
+
|-----------|------|----------|-------------|
|
|
55
|
+
| `name` | string | Yes | Human-readable name for the form |
|
|
56
|
+
| `response_format` | object | Yes | Contains field definitions and mappings |
|
|
57
|
+
| `response_format.json_formio` | array | Yes | Array of Form.io field components |
|
|
58
|
+
| `response_format.json_formio_mapping` | object | No | Maps form fields to prompt schema fields |
|
|
59
|
+
| `tag_ids` | array | No | Document tags that trigger this form |
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Form.io Field Types
|
|
64
|
+
|
|
65
|
+
DocRouter supports standard Form.io field types for building interactive forms:
|
|
66
|
+
|
|
67
|
+
### Text Field
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"type": "textfield",
|
|
72
|
+
"key": "applicant_name",
|
|
73
|
+
"label": "Applicant Name",
|
|
74
|
+
"input": true,
|
|
75
|
+
"validate": {
|
|
76
|
+
"required": true
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Use for:** Names, addresses, single-line text input
|
|
82
|
+
|
|
83
|
+
### Email Field
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"type": "email",
|
|
88
|
+
"key": "applicant_email",
|
|
89
|
+
"label": "Email Address",
|
|
90
|
+
"input": true,
|
|
91
|
+
"validate": {
|
|
92
|
+
"required": true
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Use for:** Email addresses with built-in validation
|
|
98
|
+
|
|
99
|
+
### Number Field
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"type": "number",
|
|
104
|
+
"key": "coverage_amount",
|
|
105
|
+
"label": "Coverage Amount",
|
|
106
|
+
"input": true,
|
|
107
|
+
"validate": {
|
|
108
|
+
"required": true,
|
|
109
|
+
"min": 1000,
|
|
110
|
+
"max": 1000000
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Use for:** Numeric values, amounts, quantities
|
|
116
|
+
|
|
117
|
+
### Select/Dropdown Field
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"type": "select",
|
|
122
|
+
"key": "policy_type",
|
|
123
|
+
"label": "Policy Type",
|
|
124
|
+
"input": true,
|
|
125
|
+
"data": {
|
|
126
|
+
"values": [
|
|
127
|
+
{"label": "Auto", "value": "auto"},
|
|
128
|
+
{"label": "Home", "value": "home"},
|
|
129
|
+
{"label": "Life", "value": "life"}
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
"validate": {
|
|
133
|
+
"required": true
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Use for:** Predefined options, categorical data
|
|
139
|
+
|
|
140
|
+
### Textarea Field
|
|
141
|
+
|
|
142
|
+
```json
|
|
143
|
+
{
|
|
144
|
+
"type": "textarea",
|
|
145
|
+
"key": "notes",
|
|
146
|
+
"label": "Additional Notes",
|
|
147
|
+
"input": true,
|
|
148
|
+
"rows": 5,
|
|
149
|
+
"validate": {
|
|
150
|
+
"required": false
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Use for:** Multi-line text, comments, descriptions
|
|
156
|
+
|
|
157
|
+
### Checkbox Field
|
|
158
|
+
|
|
159
|
+
```json
|
|
160
|
+
{
|
|
161
|
+
"type": "checkbox",
|
|
162
|
+
"key": "terms_accepted",
|
|
163
|
+
"label": "I accept the terms and conditions",
|
|
164
|
+
"input": true,
|
|
165
|
+
"validate": {
|
|
166
|
+
"required": true
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Use for:** Boolean yes/no, agreements, flags
|
|
172
|
+
|
|
173
|
+
### Date Field
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"type": "datetime",
|
|
178
|
+
"key": "application_date",
|
|
179
|
+
"label": "Application Date",
|
|
180
|
+
"input": true,
|
|
181
|
+
"format": "yyyy-MM-dd",
|
|
182
|
+
"validate": {
|
|
183
|
+
"required": true
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Use for:** Dates, timestamps
|
|
189
|
+
|
|
190
|
+
### Phone Number Field
|
|
191
|
+
|
|
192
|
+
```json
|
|
193
|
+
{
|
|
194
|
+
"type": "phoneNumber",
|
|
195
|
+
"key": "phone",
|
|
196
|
+
"label": "Phone Number",
|
|
197
|
+
"input": true,
|
|
198
|
+
"validate": {
|
|
199
|
+
"required": true
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Use for:** Telephone numbers with formatting
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Field Validation
|
|
209
|
+
|
|
210
|
+
Form.io provides built-in validation rules:
|
|
211
|
+
|
|
212
|
+
### Required Fields
|
|
213
|
+
|
|
214
|
+
```json
|
|
215
|
+
{
|
|
216
|
+
"validate": {
|
|
217
|
+
"required": true
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Minimum/Maximum Values
|
|
223
|
+
|
|
224
|
+
```json
|
|
225
|
+
{
|
|
226
|
+
"validate": {
|
|
227
|
+
"min": 0,
|
|
228
|
+
"max": 100
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Minimum/Maximum Length
|
|
234
|
+
|
|
235
|
+
```json
|
|
236
|
+
{
|
|
237
|
+
"validate": {
|
|
238
|
+
"minLength": 5,
|
|
239
|
+
"maxLength": 100
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Pattern/Regex Validation
|
|
245
|
+
|
|
246
|
+
```json
|
|
247
|
+
{
|
|
248
|
+
"validate": {
|
|
249
|
+
"pattern": "^[A-Z]{2}\\d{6}$"
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Custom Validation Messages
|
|
255
|
+
|
|
256
|
+
```json
|
|
257
|
+
{
|
|
258
|
+
"validate": {
|
|
259
|
+
"required": true,
|
|
260
|
+
"customMessage": "Please provide a valid policy number"
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Field Mapping
|
|
268
|
+
|
|
269
|
+
Field mapping connects form fields to AI-extracted data from prompts/schemas:
|
|
270
|
+
|
|
271
|
+
### Direct Mapping
|
|
272
|
+
|
|
273
|
+
Maps a single schema field to a form field:
|
|
274
|
+
|
|
275
|
+
```json
|
|
276
|
+
{
|
|
277
|
+
"json_formio_mapping": {
|
|
278
|
+
"applicant_name": {
|
|
279
|
+
"sources": [
|
|
280
|
+
{
|
|
281
|
+
"promptId": "prompt123",
|
|
282
|
+
"promptName": "Insurance Extraction",
|
|
283
|
+
"schemaFieldPath": "applicant.full_name",
|
|
284
|
+
"schemaFieldName": "full_name",
|
|
285
|
+
"schemaFieldType": "string"
|
|
286
|
+
}
|
|
287
|
+
],
|
|
288
|
+
"mappingType": "direct"
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Concatenated Mapping
|
|
295
|
+
|
|
296
|
+
Combines multiple schema fields into one form field:
|
|
297
|
+
|
|
298
|
+
```json
|
|
299
|
+
{
|
|
300
|
+
"json_formio_mapping": {
|
|
301
|
+
"full_name": {
|
|
302
|
+
"sources": [
|
|
303
|
+
{
|
|
304
|
+
"promptId": "prompt123",
|
|
305
|
+
"promptName": "CV Extraction",
|
|
306
|
+
"schemaFieldPath": "personal_info.first_name",
|
|
307
|
+
"schemaFieldName": "first_name",
|
|
308
|
+
"schemaFieldType": "string"
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"promptId": "prompt123",
|
|
312
|
+
"promptName": "CV Extraction",
|
|
313
|
+
"schemaFieldPath": "personal_info.last_name",
|
|
314
|
+
"schemaFieldName": "last_name",
|
|
315
|
+
"schemaFieldType": "string"
|
|
316
|
+
}
|
|
317
|
+
],
|
|
318
|
+
"mappingType": "concatenated",
|
|
319
|
+
"concatenationSeparator": " "
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### Mapping Components
|
|
326
|
+
|
|
327
|
+
| Field | Type | Required | Description |
|
|
328
|
+
|-------|------|----------|-------------|
|
|
329
|
+
| `promptId` | string | Yes | ID of the prompt that extracts this data |
|
|
330
|
+
| `promptName` | string | Yes | Human-readable prompt name |
|
|
331
|
+
| `schemaFieldPath` | string | Yes | Dot-notation path to field in schema |
|
|
332
|
+
| `schemaFieldName` | string | Yes | Name of the field in the schema |
|
|
333
|
+
| `schemaFieldType` | string | Yes | Data type (string, number, boolean, etc.) |
|
|
334
|
+
| `mappingType` | string | Yes | "direct" or "concatenated" |
|
|
335
|
+
| `concatenationSeparator` | string | No | Separator for concatenated fields (default: space) |
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## Best Practices
|
|
340
|
+
|
|
341
|
+
### 1. Organize Fields Logically
|
|
342
|
+
|
|
343
|
+
Group related fields together:
|
|
344
|
+
|
|
345
|
+
```json
|
|
346
|
+
[
|
|
347
|
+
{
|
|
348
|
+
"type": "textfield",
|
|
349
|
+
"key": "first_name",
|
|
350
|
+
"label": "First Name"
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"type": "textfield",
|
|
354
|
+
"key": "last_name",
|
|
355
|
+
"label": "Last Name"
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
"type": "email",
|
|
359
|
+
"key": "email",
|
|
360
|
+
"label": "Email"
|
|
361
|
+
}
|
|
362
|
+
]
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### 2. Use Clear, Descriptive Labels
|
|
366
|
+
|
|
367
|
+
**Good:**
|
|
368
|
+
```json
|
|
369
|
+
{
|
|
370
|
+
"label": "Street Address (Line 1)"
|
|
371
|
+
}
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
**Avoid:**
|
|
375
|
+
```json
|
|
376
|
+
{
|
|
377
|
+
"label": "Addr"
|
|
378
|
+
}
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### 3. Set Appropriate Validation
|
|
382
|
+
|
|
383
|
+
Match validation rules to data requirements:
|
|
384
|
+
|
|
385
|
+
```json
|
|
386
|
+
{
|
|
387
|
+
"type": "email",
|
|
388
|
+
"validate": {
|
|
389
|
+
"required": true,
|
|
390
|
+
"customMessage": "A valid email address is required for correspondence"
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### 4. Use Field Mapping for Automation
|
|
396
|
+
|
|
397
|
+
Map form fields to schema fields to auto-populate from AI extraction:
|
|
398
|
+
|
|
399
|
+
```json
|
|
400
|
+
{
|
|
401
|
+
"json_formio_mapping": {
|
|
402
|
+
"email": {
|
|
403
|
+
"sources": [{
|
|
404
|
+
"promptId": "cv_prompt",
|
|
405
|
+
"schemaFieldPath": "personal_info.email"
|
|
406
|
+
}],
|
|
407
|
+
"mappingType": "direct"
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
### 5. Choose Appropriate Field Types
|
|
414
|
+
|
|
415
|
+
- Use `select` for predefined options
|
|
416
|
+
- Use `number` for numeric values (enables numeric validation)
|
|
417
|
+
- Use `email` for email addresses (enables email validation)
|
|
418
|
+
- Use `textarea` for multi-line text
|
|
419
|
+
|
|
420
|
+
### 6. Provide Helpful Placeholders
|
|
421
|
+
|
|
422
|
+
```json
|
|
423
|
+
{
|
|
424
|
+
"type": "textfield",
|
|
425
|
+
"key": "phone",
|
|
426
|
+
"label": "Phone Number",
|
|
427
|
+
"placeholder": "(555) 123-4567"
|
|
428
|
+
}
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
433
|
+
## API Integration
|
|
434
|
+
|
|
435
|
+
DocRouter provides multiple ways to interact with forms programmatically:
|
|
436
|
+
|
|
437
|
+
- **TypeScript/JavaScript SDK** - Type-safe client library (see `packages/typescript/docrouter-sdk/`)
|
|
438
|
+
- **Python SDK** - Type-safe Python client library (see `packages/docrouter_sdk/`)
|
|
439
|
+
- **REST API** - Direct HTTP requests
|
|
440
|
+
- **MCP (Model Context Protocol)** - Integration with AI assistants like Claude Code
|
|
441
|
+
|
|
442
|
+
All methods support: create, list, retrieve, update, delete forms, and submit/retrieve form submissions.
|
|
443
|
+
|
|
444
|
+
---
|
|
445
|
+
|
|
446
|
+
## Examples
|
|
447
|
+
|
|
448
|
+
### Example 1: Simple Contact Form
|
|
449
|
+
|
|
450
|
+
```json
|
|
451
|
+
{
|
|
452
|
+
"name": "Contact Information",
|
|
453
|
+
"response_format": {
|
|
454
|
+
"json_formio": [
|
|
455
|
+
{
|
|
456
|
+
"type": "textfield",
|
|
457
|
+
"key": "full_name",
|
|
458
|
+
"label": "Full Name",
|
|
459
|
+
"input": true,
|
|
460
|
+
"validate": {
|
|
461
|
+
"required": true
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
"type": "email",
|
|
466
|
+
"key": "email",
|
|
467
|
+
"label": "Email Address",
|
|
468
|
+
"input": true,
|
|
469
|
+
"validate": {
|
|
470
|
+
"required": true
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
"type": "phoneNumber",
|
|
475
|
+
"key": "phone",
|
|
476
|
+
"label": "Phone Number",
|
|
477
|
+
"input": true,
|
|
478
|
+
"validate": {
|
|
479
|
+
"required": false
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
]
|
|
483
|
+
},
|
|
484
|
+
"tag_ids": []
|
|
485
|
+
}
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
### Example 2: Insurance Application Form
|
|
489
|
+
|
|
490
|
+
```json
|
|
491
|
+
{
|
|
492
|
+
"name": "Insurance Application",
|
|
493
|
+
"response_format": {
|
|
494
|
+
"json_formio": [
|
|
495
|
+
{
|
|
496
|
+
"type": "textfield",
|
|
497
|
+
"key": "applicant_name",
|
|
498
|
+
"label": "Applicant Name",
|
|
499
|
+
"input": true,
|
|
500
|
+
"validate": {
|
|
501
|
+
"required": true
|
|
502
|
+
}
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
"type": "email",
|
|
506
|
+
"key": "applicant_email",
|
|
507
|
+
"label": "Email Address",
|
|
508
|
+
"input": true,
|
|
509
|
+
"validate": {
|
|
510
|
+
"required": true
|
|
511
|
+
}
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
"type": "number",
|
|
515
|
+
"key": "coverage_amount",
|
|
516
|
+
"label": "Coverage Amount ($)",
|
|
517
|
+
"input": true,
|
|
518
|
+
"validate": {
|
|
519
|
+
"required": true,
|
|
520
|
+
"min": 1000
|
|
521
|
+
}
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
"type": "select",
|
|
525
|
+
"key": "policy_type",
|
|
526
|
+
"label": "Policy Type",
|
|
527
|
+
"input": true,
|
|
528
|
+
"data": {
|
|
529
|
+
"values": [
|
|
530
|
+
{"label": "Auto Insurance", "value": "auto"},
|
|
531
|
+
{"label": "Home Insurance", "value": "home"},
|
|
532
|
+
{"label": "Life Insurance", "value": "life"}
|
|
533
|
+
]
|
|
534
|
+
},
|
|
535
|
+
"validate": {
|
|
536
|
+
"required": true
|
|
537
|
+
}
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
"type": "textarea",
|
|
541
|
+
"key": "additional_notes",
|
|
542
|
+
"label": "Additional Notes",
|
|
543
|
+
"input": true,
|
|
544
|
+
"rows": 4,
|
|
545
|
+
"validate": {
|
|
546
|
+
"required": false
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
]
|
|
550
|
+
},
|
|
551
|
+
"tag_ids": ["insurance"]
|
|
552
|
+
}
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
### Example 3: CV Review Form with Mapping
|
|
556
|
+
|
|
557
|
+
```json
|
|
558
|
+
{
|
|
559
|
+
"name": "CV Review Form",
|
|
560
|
+
"response_format": {
|
|
561
|
+
"json_formio": [
|
|
562
|
+
{
|
|
563
|
+
"type": "textfield",
|
|
564
|
+
"key": "candidate_name",
|
|
565
|
+
"label": "Candidate Name",
|
|
566
|
+
"input": true,
|
|
567
|
+
"validate": {
|
|
568
|
+
"required": true
|
|
569
|
+
}
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
"type": "email",
|
|
573
|
+
"key": "email",
|
|
574
|
+
"label": "Email",
|
|
575
|
+
"input": true,
|
|
576
|
+
"validate": {
|
|
577
|
+
"required": true
|
|
578
|
+
}
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
"type": "phoneNumber",
|
|
582
|
+
"key": "phone",
|
|
583
|
+
"label": "Phone Number",
|
|
584
|
+
"input": true,
|
|
585
|
+
"validate": {
|
|
586
|
+
"required": false
|
|
587
|
+
}
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
"type": "textfield",
|
|
591
|
+
"key": "current_position",
|
|
592
|
+
"label": "Current Position",
|
|
593
|
+
"input": true,
|
|
594
|
+
"validate": {
|
|
595
|
+
"required": false
|
|
596
|
+
}
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
"type": "textarea",
|
|
600
|
+
"key": "skills",
|
|
601
|
+
"label": "Technical Skills",
|
|
602
|
+
"input": true,
|
|
603
|
+
"rows": 5,
|
|
604
|
+
"validate": {
|
|
605
|
+
"required": false
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
],
|
|
609
|
+
"json_formio_mapping": {
|
|
610
|
+
"candidate_name": {
|
|
611
|
+
"sources": [
|
|
612
|
+
{
|
|
613
|
+
"promptId": "cv_extraction_prompt",
|
|
614
|
+
"promptName": "CV Extraction",
|
|
615
|
+
"schemaFieldPath": "personal_info.name",
|
|
616
|
+
"schemaFieldName": "name",
|
|
617
|
+
"schemaFieldType": "string"
|
|
618
|
+
}
|
|
619
|
+
],
|
|
620
|
+
"mappingType": "direct"
|
|
621
|
+
},
|
|
622
|
+
"email": {
|
|
623
|
+
"sources": [
|
|
624
|
+
{
|
|
625
|
+
"promptId": "cv_extraction_prompt",
|
|
626
|
+
"promptName": "CV Extraction",
|
|
627
|
+
"schemaFieldPath": "personal_info.email",
|
|
628
|
+
"schemaFieldName": "email",
|
|
629
|
+
"schemaFieldType": "string"
|
|
630
|
+
}
|
|
631
|
+
],
|
|
632
|
+
"mappingType": "direct"
|
|
633
|
+
},
|
|
634
|
+
"phone": {
|
|
635
|
+
"sources": [
|
|
636
|
+
{
|
|
637
|
+
"promptId": "cv_extraction_prompt",
|
|
638
|
+
"promptName": "CV Extraction",
|
|
639
|
+
"schemaFieldPath": "personal_info.phone",
|
|
640
|
+
"schemaFieldName": "phone",
|
|
641
|
+
"schemaFieldType": "string"
|
|
642
|
+
}
|
|
643
|
+
],
|
|
644
|
+
"mappingType": "direct"
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
},
|
|
648
|
+
"tag_ids": ["cv", "resume"]
|
|
649
|
+
}
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
---
|
|
653
|
+
|
|
654
|
+
## Form Workflow
|
|
655
|
+
|
|
656
|
+
### 1. Design Phase
|
|
657
|
+
- Identify what data needs human review
|
|
658
|
+
- Determine required vs optional fields
|
|
659
|
+
- Design validation rules
|
|
660
|
+
- Plan field mappings to prompt schemas
|
|
661
|
+
|
|
662
|
+
### 2. Creation Phase
|
|
663
|
+
- Create form with Form.io field definitions
|
|
664
|
+
- Configure validation rules
|
|
665
|
+
- Set up field mappings
|
|
666
|
+
- Associate with document tags
|
|
667
|
+
|
|
668
|
+
### 3. Usage Phase
|
|
669
|
+
- Documents uploaded with matching tags trigger form display
|
|
670
|
+
- AI-extracted data auto-populates mapped fields
|
|
671
|
+
- Human reviewers verify, edit, and submit
|
|
672
|
+
- Submitted data is validated and stored
|
|
673
|
+
|
|
674
|
+
### 4. Submission Management
|
|
675
|
+
- Retrieve form submissions via API
|
|
676
|
+
- Update submissions if corrections needed
|
|
677
|
+
- Mark submissions as verified
|
|
678
|
+
- Export data for downstream processing
|
|
679
|
+
|
|
680
|
+
---
|
|
681
|
+
|
|
682
|
+
## Troubleshooting
|
|
683
|
+
|
|
684
|
+
### Common Issues
|
|
685
|
+
|
|
686
|
+
**Issue:** Form fields not auto-populating from AI extraction
|
|
687
|
+
- **Solution:** Verify field mappings reference correct promptId and schemaFieldPath
|
|
688
|
+
|
|
689
|
+
**Issue:** Validation errors on submission
|
|
690
|
+
- **Solution:** Check validate.required and other validation rules match data expectations
|
|
691
|
+
|
|
692
|
+
**Issue:** Form not displaying for documents
|
|
693
|
+
- **Solution:** Ensure document tags match form tag_ids
|
|
694
|
+
|
|
695
|
+
**Issue:** Field mapping not working
|
|
696
|
+
- **Solution:** Verify prompt has run successfully and schema field path is correct
|
|
697
|
+
|
|
698
|
+
---
|
|
699
|
+
|
|
700
|
+
## Version Control
|
|
701
|
+
|
|
702
|
+
DocRouter maintains form versioning:
|
|
703
|
+
|
|
704
|
+
- Each form update creates a new version (if response_format changes)
|
|
705
|
+
- Name-only updates do not create new versions
|
|
706
|
+
- `form_version` increments with each structural change
|
|
707
|
+
- `form_revid` uniquely identifies each version
|
|
708
|
+
- Previous versions remain accessible for historical submissions
|
|
709
|
+
|
|
710
|
+
---
|
|
711
|
+
|
|
712
|
+
## References
|
|
713
|
+
|
|
714
|
+
- [Form.io Documentation](https://help.form.io/)
|
|
715
|
+
- [Form.io Field Components](https://help.form.io/userguide/forms/form-components)
|
|
716
|
+
- [DocRouter API Documentation](../README.md)
|
|
717
|
+
- [Schema Definition Manual](./schemas.md)
|
|
718
|
+
- [Prompt Configuration Guide](./prompts.md)
|
|
719
|
+
|
|
720
|
+
---
|
|
721
|
+
|
|
722
|
+
**Document Version:** 1.0
|
|
723
|
+
**Last Updated:** 2025-01-11
|
|
724
|
+
**Maintained by:** DocRouter Development Team
|