{ "type": "object", "title": "DeliveryNoteExtractionSchema", "description": "Schema for extracting structured data from a delivery note (BL document). Every leaf field uses value/confidence wrapper.", "additionalProperties": false, "properties": { "delivery_note_number": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object", "description": "Delivery note identifier / bon de livraison" }, "delivery_note_year": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object", "description": "Delivery note year / année du bon de livraison" }, "delivery_note_full": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object", "description": "Full delivery note reference combining number and year" }, "supplier": { "additionalProperties": false, "properties": { "name": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "address": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "tax_id": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "postal_code": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "commercial_register": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "phone": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "fax": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "email": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" } }, "required": [ "name", "address", "tax_id", "postal_code", "commercial_register", "phone", "fax", "email" ], "type": "object", "description": "Supplier information" }, "client": { "additionalProperties": false, "properties": { "client_code": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "name": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "address": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "tax_id": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" } }, "required": [ "client_code", "name", "address", "tax_id" ], "type": "object", "description": "Client information" }, "document_meta": { "additionalProperties": false, "properties": { "document_date": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "delivery_date": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "order_number": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "payment_mode": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "delivery_mode": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "carton_count": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "minimum": 0, "type": [ "integer", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "page": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "minimum": 0, "type": [ "integer", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "handlers": { "additionalProperties": false, "properties": { "taken_by": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "drawn_by": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "entered_by": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "prepared_by": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "delivered_by": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "validated_by": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "requested_by": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" } }, "required": [ "taken_by", "drawn_by", "entered_by", "prepared_by", "delivered_by", "validated_by", "requested_by" ], "type": "object" } }, "required": [ "document_date", "delivery_date", "order_number", "payment_mode", "delivery_mode", "carton_count", "page", "handlers" ], "type": "object", "description": "Document metadata" }, "products": { "description": "List of products with pricing, quantities, and commercial details", "items": { "additionalProperties": false, "properties": { "product_code": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object", "description": "Manufacturer/distributor product code (Code PCT / code article). An identifier string, NOT a quantity or a price. May be long (5+ digits)." }, "designation": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object", "description": "Product name/label as printed (Désignation)." }, "quantity": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "maximum": 999.0, "minimum": 0.0, "type": [ "number", "null" ] } }, "required": [ "confidence", "value" ], "type": "object", "description": "Number of units delivered, from the Qté column. A small integer, typically 1-99 (rarely up to a few hundred). NEVER a product code. If you read a value >= 1000 you have almost certainly picked up the Code PCT column instead." }, "public_unit_price": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "minimum": 0.0, "type": [ "number", "null" ] } }, "required": [ "confidence", "value" ], "type": "object", "description": "Public retail price for ONE unit (Prix Public / PPV) — what the patient pays at the counter. This is the HIGHEST per-unit price on the line. Must be strictly greater than pharmacist_price_ttc." }, "pharmacist_price_ht": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "minimum": 0.0, "type": [ "number", "null" ] } }, "required": [ "confidence", "value" ], "type": "object", "description": "Pharmacist purchase price for ONE unit, EXCLUDING tax (PU HT / prix d'achat HT). This is what the pharmacy pays the supplier per unit before VAT. Lower than public_unit_price. Equals pharmacist_price_ttc / (1 + vat_rate)." }, "pharmacist_price_ttc": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "minimum": 0.0, "type": [ "number", "null" ] } }, "required": [ "confidence", "value" ], "type": "object", "description": "Pharmacist purchase price for ONE unit, INCLUDING tax (NET unit price). Lower than public_unit_price and NEVER equal to it. Equals pharmacist_price_ht * (1 + vat_rate). Sanity check: quantity * pharmacist_price_ttc should approximate line_total_ttc." }, "vat_rate": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "maximum": 100.0, "minimum": 0.0, "type": [ "number", "null" ] } }, "required": [ "confidence", "value" ], "type": "object", "description": "VAT rate applied to this line, as a number (e.g. 0, 7, 19). Percent value, not a fraction." }, "line_total_ht": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "minimum": 0.0, "type": [ "number", "null" ] } }, "required": [ "confidence", "value" ], "type": "object", "description": "Line total for this product EXCLUDING tax = quantity * pharmacist_price_ht (the TOTAL HT BASE amount for the line). Uses the pharmacist price, never the public price." }, "line_total_ttc": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "minimum": 0.0, "type": [ "number", "null" ] } }, "required": [ "confidence", "value" ], "type": "object", "description": "Line total for this product INCLUDING tax = quantity * pharmacist_price_ttc. The sum of line_total_ttc across all products must approximate totals.total_ttc. Uses the pharmacist price, NEVER the public retail price (using the public price inflates the sum by ~30-35%)." }, "expiry_date": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object", "description": "Product expiry date (péremption) if printed on the line, else null." }, "free_unit": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "boolean", "null" ] } }, "required": [ "confidence", "value" ], "type": "object", "description": "true if this line is a free/bonus unit (UG / unité gratuite / remise en nature), else false." } }, "required": [ "product_code", "designation", "quantity", "public_unit_price", "pharmacist_price_ht", "pharmacist_price_ttc", "vat_rate", "line_total_ht", "line_total_ttc", "expiry_date", "free_unit" ], "type": "object" }, "type": "array" }, "totals": { "additionalProperties": false, "properties": { "base_ht": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "minimum": 0.0, "type": [ "number", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "net_ht": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "minimum": 0.0, "type": [ "number", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "total_milk": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "minimum": 0.0, "type": [ "number", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "vat_rate": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "maximum": 100.0, "minimum": 0.0, "type": [ "number", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "vat_base": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "minimum": 0.0, "type": [ "number", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "vat_amount": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "minimum": 0.0, "type": [ "number", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "total_ht": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "minimum": 0.0, "type": [ "number", "null" ] } }, "required": [ "confidence", "value" ], "type": "object", "description": "Grand total excluding tax (base HT)." }, "total_ttc": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "minimum": 0.0, "type": [ "number", "null" ] } }, "required": [ "confidence", "value" ], "type": "object", "description": "Grand total payable including tax. The sum of all products' line_total_ttc must approximate this value." }, "amount_in_words": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "type": [ "string", "null" ] } }, "required": [ "confidence", "value" ], "type": "object" }, "line_count": { "additionalProperties": false, "properties": { "confidence": { "maximum": 1.0, "minimum": 0.0, "type": "number" }, "value": { "minimum": 0, "type": [ "integer", "null" ] } }, "required": [ "confidence", "value" ], "type": "object", "description": "Number of product lines on the document. If > 0, the products array must not be empty." } }, "required": [ "base_ht", "net_ht", "total_milk", "vat_rate", "vat_base", "vat_amount", "total_ht", "total_ttc", "amount_in_words", "line_count" ], "type": "object", "description": "Document financial totals" } }, "required": [ "delivery_note_number", "delivery_note_year", "delivery_note_full", "supplier", "client", "document_meta", "products", "totals" ] }