hyf

Context-aware query service for Radroots
git clone https://radroots.dev/git/hyf.git
Log | Files | Refs | README | LICENSE

farm_update_interpret.request.schema.json (8934B)


      1 {
      2   "$schema": "https://json-schema.org/draft/2020-12/schema",
      3   "$id": "hyf_ops_v2/farm_update_interpret.request.schema.json",
      4   "title": "hyf_ops_v2 farm_update.interpret strict request (ADR-0025 D45 CB01-CB04)",
      5   "$comment": "Corrected versioned operation contract. Selected by context.versions.schema=hyf_ops_v2. Strict closed objects; duplicate keys are rejected by the semantic layer, not by JSON Schema. Envelope version stays 1.",
      6   "type": "object",
      7   "properties": {
      8     "version": {
      9       "type": "integer",
     10       "const": 1
     11     },
     12     "request_id": {
     13       "type": "string",
     14       "minLength": 1
     15     },
     16     "trace_id": {
     17       "type": "string",
     18       "minLength": 1
     19     },
     20     "capability": {
     21       "type": "string",
     22       "const": "farm_update.interpret"
     23     },
     24     "context": {
     25       "$ref": "#/$defs/farm_context"
     26     },
     27     "input": {
     28       "$ref": "#/$defs/farm_input"
     29     }
     30   },
     31   "required": ["version", "request_id", "capability", "context", "input"],
     32   "additionalProperties": false,
     33   "$defs": {
     34     "versions": {
     35       "type": "object",
     36       "properties": {
     37         "schema": {
     38           "type": "string",
     39           "const": "hyf_ops_v2"
     40         },
     41         "taxonomy": {
     42           "type": "string",
     43           "minLength": 1
     44         },
     45         "normalization": {
     46           "type": "string",
     47           "minLength": 1
     48         },
     49         "review_policy": {
     50           "type": "string",
     51           "minLength": 1
     52         },
     53         "ranking_policy": {
     54           "type": "string",
     55           "minLength": 1
     56         },
     57         "question_bundle": {
     58           "type": "string",
     59           "minLength": 1
     60         },
     61         "model": {
     62           "type": "string",
     63           "minLength": 1
     64         }
     65       },
     66       "required": [
     67         "schema",
     68         "taxonomy",
     69         "normalization",
     70         "review_policy",
     71         "ranking_policy",
     72         "question_bundle",
     73         "model"
     74       ],
     75       "additionalProperties": false
     76     },
     77     "farm_context": {
     78       "type": "object",
     79       "properties": {
     80         "consumer": {
     81           "type": "string",
     82           "minLength": 1
     83         },
     84         "execution_mode_preference": {
     85           "type": "string",
     86           "enum": ["deterministic", "assisted"]
     87         },
     88         "deadline_ms": {
     89           "type": "integer",
     90           "minimum": 1
     91         },
     92         "evaluation_time": {
     93           "type": "string",
     94           "minLength": 1
     95         },
     96         "timezone": {
     97           "type": "string",
     98           "minLength": 1
     99         },
    100         "locale": {
    101           "type": "string",
    102           "minLength": 1
    103         },
    104         "versions": {
    105           "$ref": "#/$defs/versions"
    106         },
    107         "return_provenance": {
    108           "type": "boolean"
    109         },
    110         "actor_id": {
    111           "type": "string",
    112           "minLength": 1
    113         },
    114         "farm_id": {
    115           "type": "string",
    116           "minLength": 1
    117         }
    118       },
    119       "required": ["evaluation_time", "versions", "actor_id", "farm_id"],
    120       "additionalProperties": false
    121     },
    122     "interpretation_source_farm": {
    123       "type": "object",
    124       "properties": {
    125         "source_id": {
    126           "type": "string",
    127           "minLength": 1
    128         },
    129         "revision": {
    130           "type": "string",
    131           "minLength": 1
    132         },
    133         "text": {
    134           "type": "string",
    135           "minLength": 1
    136         },
    137         "source_time": {
    138           "type": "string",
    139           "minLength": 1
    140         },
    141         "timezone": {
    142           "type": "string",
    143           "minLength": 1
    144         },
    145         "locale": {
    146           "type": "string",
    147           "minLength": 1
    148         },
    149         "actor_id": {
    150           "type": "string",
    151           "minLength": 1
    152         },
    153         "farm_id": {
    154           "type": "string",
    155           "minLength": 1
    156         },
    157         "ingestion_time": {
    158           "type": "string",
    159           "minLength": 1
    160         }
    161       },
    162       "required": [
    163         "source_id",
    164         "revision",
    165         "text",
    166         "source_time",
    167         "actor_id",
    168         "farm_id"
    169       ],
    170       "additionalProperties": false
    171     },
    172     "taxonomy_bundle": {
    173       "type": "object",
    174       "properties": {
    175         "version": {
    176           "type": "string",
    177           "minLength": 1
    178         },
    179         "provenance": {
    180           "type": "string",
    181           "enum": ["synthetic", "host_supplied"]
    182         },
    183         "products": {
    184           "type": "array",
    185           "items": {
    186             "type": "object",
    187             "properties": {
    188               "catalogue_id": {
    189                 "type": "string",
    190                 "minLength": 1
    191               },
    192               "terms": {
    193                 "type": "array",
    194                 "minItems": 1,
    195                 "items": {"type": "string", "minLength": 1}
    196               }
    197             },
    198             "required": ["catalogue_id", "terms"],
    199             "additionalProperties": false
    200           }
    201         }
    202       },
    203       "required": ["version", "provenance", "products"],
    204       "additionalProperties": false
    205     },
    206     "normalization_bundle": {
    207       "type": "object",
    208       "properties": {
    209         "version": {
    210           "type": "string",
    211           "minLength": 1
    212         },
    213         "provenance": {
    214           "type": "string",
    215           "enum": ["synthetic", "host_supplied"]
    216         },
    217         "units": {
    218           "type": "array",
    219           "items": {
    220             "type": "object",
    221             "properties": {
    222               "unit": {"type": "string", "minLength": 1},
    223               "dimension": {
    224                 "type": "string",
    225                 "enum": ["mass", "volume", "count", "unknown"]
    226               }
    227             },
    228             "required": ["unit", "dimension"],
    229             "additionalProperties": false
    230           }
    231         },
    232         "conversions": {
    233           "type": "array",
    234           "items": {
    235             "type": "object",
    236             "properties": {
    237               "from_unit": {"type": "string", "minLength": 1},
    238               "to_unit": {"type": "string", "minLength": 1},
    239               "numerator": {"type": "string", "pattern": "^[1-9][0-9]*$"},
    240               "denominator": {"type": "string", "pattern": "^10*$"}
    241             },
    242             "required": ["from_unit", "to_unit", "numerator", "denominator"],
    243             "additionalProperties": false
    244           }
    245         },
    246         "packs": {
    247           "type": "array",
    248           "items": {
    249             "type": "object",
    250             "properties": {
    251               "product_id": {"type": "string", "minLength": 1},
    252               "pack_unit": {"type": "string", "minLength": 1},
    253               "inner_unit": {"type": "string", "minLength": 1},
    254               "value": {
    255                 "type": "string",
    256                 "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]{1,9})?$",
    257                 "allOf": [
    258                   {"not": {"const": "0"}},
    259                   {"not": {"pattern": "^0(\\.0+)?$"}}
    260                 ]
    261               }
    262             },
    263             "required": ["product_id", "pack_unit", "inner_unit", "value"],
    264             "additionalProperties": false
    265           }
    266         }
    267       },
    268       "required": ["version", "provenance", "units", "conversions", "packs"],
    269       "additionalProperties": false
    270     },
    271     "references": {
    272       "type": "object",
    273       "properties": {
    274         "taxonomy": {
    275           "$ref": "#/$defs/taxonomy_bundle"
    276         },
    277         "normalization": {
    278           "$ref": "#/$defs/normalization_bundle"
    279         }
    280       },
    281       "required": ["taxonomy", "normalization"],
    282       "additionalProperties": false
    283     },
    284     "prior_records": {
    285       "type": "array",
    286       "items": {
    287         "type": "object",
    288         "properties": {
    289           "record_id": {"type": "string", "minLength": 1},
    290           "revision": {"type": "string", "minLength": 1},
    291           "role": {"type": "string", "minLength": 1},
    292           "farm_id": {"type": "string", "minLength": 1}
    293         },
    294         "required": ["record_id", "revision", "role", "farm_id"],
    295         "additionalProperties": false
    296       }
    297     },
    298     "clarification": {
    299       "type": "object",
    300       "properties": {
    301         "source_id": {"type": "string", "minLength": 1},
    302         "revision": {"type": "string", "minLength": 1},
    303         "target_field": {"type": "string", "minLength": 1},
    304         "text": {"type": "string", "minLength": 1},
    305         "expected_revision": {"type": "string", "minLength": 1}
    306       },
    307       "required": ["source_id", "revision", "target_field", "text", "expected_revision"],
    308       "additionalProperties": false
    309     },
    310     "farm_input": {
    311       "type": "object",
    312       "properties": {
    313         "source": {
    314           "$ref": "#/$defs/interpretation_source_farm"
    315         },
    316         "references": {
    317           "$ref": "#/$defs/references"
    318         },
    319         "prior_records": {
    320           "$ref": "#/$defs/prior_records"
    321         },
    322         "clarification": {
    323           "$ref": "#/$defs/clarification"
    324         }
    325       },
    326       "required": ["source", "references"],
    327       "additionalProperties": false
    328     }
    329   }
    330 }