--- name: document-verification description: Validate uploaded documents (CoA, MSDS, spec sheets). Check format, expiry dates, completeness, and flag issues automatically. --- # Document Verification Skill ## When to Use - Supplier uploads new document - Periodic document expiry check - Pre-approval document audit - Client requests registration pack ## Document Types & Requirements ### Certificate of Analysis (CoA) **Purpose:** Proves batch meets specifications | Field | Required | Validation | |-------|----------|------------| | Product name | ✓ | Must match product record | | Batch/Lot number | ✓ | Format check | | Manufacturing date | ✓ | Not future dated | | Expiry date | ✓ | Must be future, calculate shelf life | | Test date | ✓ | Within 30 days of manufacture | | Lab name | ✓ | Check if accredited | | Lab accreditation # | ✓ | Verify ISO 17025 | | Specifications | ✓ | All specs listed | | Results | ✓ | All within spec limits | | Pass/Fail status | ✓ | Must be PASS | | Authorized signature | ✓ | Name + signature present | **Auto-Fail Conditions:** - Any result outside specification - Missing test parameters - Expired document (>2 years old) - Unaccredited lab for regulated tests - No signature/authorization ### Material Safety Data Sheet (MSDS/SDS) **Purpose:** Safety information for handling | Section | Required | Check | |---------|----------|-------| | 1. Identification | ✓ | Product name matches | | 2. Hazard identification | ✓ | GHS classification | | 3. Composition | ✓ | Ingredients listed | | 4. First-aid measures | ✓ | Complete | | 5. Fire-fighting | ✓ | Complete | | 6. Accidental release | ✓ | Complete | | 7. Handling & storage | ✓ | Conditions specified | | 8. Exposure controls | ✓ | PPE listed | | 9. Physical properties | ✓ | pH, density, etc. | | 10. Stability & reactivity | ✓ | Complete | | 11. Toxicological info | ✓ | Safety data | | 12. Ecological info | ✓ | Environmental impact | | 13. Disposal | ✓ | Proper disposal method | | 14. Transport | ✓ | UN number if hazardous | | 15. Regulatory | ✓ | Compliance statements | | 16. Other | ○ | Revision date | **Auto-Fail Conditions:** - Missing any of sections 1-11 - Document older than 5 years - Wrong GHS format version - No revision date ### Specification Sheet / TDS **Purpose:** Product specifications for ordering | Field | Required | Cosmetics | Supplements | |-------|----------|-----------|-------------| | Product name | ✓ | ✓ | ✓ | | SKU/Code | ✓ | ✓ | ✓ | | Description | ✓ | ✓ | ✓ | | INCI list | ✓ | ✓ | - | | Ingredients | ✓ | ✓ | ✓ | | Active doses | ✓ | - | ✓ | | Appearance | ✓ | ✓ | ✓ | | Color | ✓ | ✓ | ✓ | | Odor | ✓ | ✓ | ○ | | pH | ✓ | ✓ | - | | Viscosity | ○ | ✓ | - | | Serving size | ✓ | - | ✓ | | Servings per container | ✓ | - | ✓ | | Net weight/volume | ✓ | ✓ | ✓ | | Packaging | ✓ | ✓ | ✓ | | Storage conditions | ✓ | ✓ | ✓ | | Shelf life | ✓ | ✓ | ✓ | ### Stability Report **Purpose:** Proves product stability over time | Check | Requirement | |-------|-------------| | Study type | Accelerated (3mo) OR Real-time (12mo+) | | Conditions | 25°C/60%RH and 40°C/75%RH | | Time points | 0, 1, 2, 3 months minimum | | Parameters tested | Appearance, pH, micro, actives | | Results | All within spec at all time points | | Conclusion | Shelf life justified | ### GMP/Quality Certificates **Purpose:** Manufacturing quality assurance | Check | Requirement | |-------|-------------| | Issuing body | Recognized authority/notified body | | Scope | Covers product type (cosmetics/food/pharma) | | Validity | Not expired | | Site address | Matches manufacturing address | | Audit date | Within certification period | ## Verification Workflow ``` Document Uploaded ↓ [1] Format Check - Is it PDF? (required) - Is it readable/not corrupted? - Is it in English or translatable? ↓ [2] Type Detection - Identify document type from content - Route to appropriate checklist ↓ [3] Field Extraction (MIRAG) - Extract key fields - Parse dates, numbers, results ↓ [4] Validation - Check all required fields present - Verify dates (not expired, not future) - Cross-reference with product data - Flag any out-of-spec results ↓ [5] Result ✓ VERIFIED → Mark as valid, set expiry reminder ⚠ NEEDS REVIEW → Flag for human review ✗ REJECTED → Auto-reject with reasons ``` ## Expiry Tracking | Document Type | Validity Period | Remind Before | |---------------|----------------|---------------| | CoA | 2 years from test date | 30 days | | MSDS | 5 years from revision | 60 days | | GMP Certificate | Per cert (usually 3yr) | 90 days | | Stability Report | Ongoing | When shelf life changes | | Halal Certificate | 1-2 years | 60 days | ## Integration with OOi ```yaml type: document layer1: # Public metadata name: "CoA - Product X - Batch 2026-001" document_type: "coa" upload_date: "2026-03-31" layer2: # B2B visible product_id: "..." batch_number: "2026-001" test_date: "2026-03-15" expiry_date: "2028-03-15" status: "verified" layer4: # Internal verification_date: "2026-03-31" verified_by: "system" flags: [] notes: "" file_path: "/uploads/coa/..." layer5: # Relations - product: product_id - supplier: supplier_id - batch: batch_id ``` ## API Response Codes | Code | Meaning | Action | |------|---------|--------| | `DOC_VALID` | All checks passed | Accept | | `DOC_EXPIRED` | Document past validity | Request new version | | `DOC_INCOMPLETE` | Missing required fields | List missing fields | | `DOC_MISMATCH` | Product name mismatch | Verify correct document | | `DOC_OUT_OF_SPEC` | Results outside limits | Reject batch | | `DOC_UNREADABLE` | Cannot parse PDF | Request clearer scan | | `DOC_NEEDS_TRANSLATION` | Not in English | Request translation |