SPB Git

spb/air Public MIT

AIR — The Language of Accounting.

Python 100%
12.1 KB · 565 lines json
Raw Blame History
1{2  "_author": "Simon-Pierre Boucher <contact@spboucher.ai>",3  "$schema": "https://json-schema.org/draft/2020-12/schema",4  "$id": "https://spboucher.ai/air/schemas/air-0.1.schema.json",5  "title": "AirDocument",6  "$defs": {7    "AmountSpec": {8      "additionalProperties": false,9      "description": "An amount as it appears in AIR documents (exact decimal + currency).",10      "properties": {11        "amount": {12          "anyOf": [13            {14              "type": "number"15            },16            {17              "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",18              "type": "string"19            }20          ],21          "title": "Amount"22        },23        "currency": {24          "title": "Currency",25          "type": "string"26        }27      },28      "required": [29        "amount",30        "currency"31      ],32      "title": "AmountSpec",33      "type": "object"34    },35    "DeliveryInfo": {36      "additionalProperties": false,37      "properties": {38        "status": {39          "default": "pending",40          "title": "Status",41          "type": "string"42        },43        "expected": {44          "anyOf": [45            {46              "format": "date",47              "type": "string"48            },49            {50              "type": "null"51            }52          ],53          "default": null,54          "title": "Expected"55        }56      },57      "title": "DeliveryInfo",58      "type": "object"59    },60    "EconomicEvent": {61      "additionalProperties": false,62      "description": "A single economic event \u2014 the atom of the AIR language.",63      "properties": {64        "air_version": {65          "default": "0.1",66          "title": "Air Version",67          "type": "string"68        },69        "id": {70          "title": "Id",71          "type": "string"72        },73        "type": {74          "$ref": "#/$defs/EventType"75        },76        "date": {77          "format": "date",78          "title": "Date",79          "type": "string"80        },81        "description": {82          "anyOf": [83            {84              "type": "string"85            },86            {87              "type": "null"88            }89          ],90          "default": null,91          "title": "Description"92        },93        "parties": {94          "additionalProperties": {95            "type": "string"96          },97          "title": "Parties",98          "type": "object"99        },100        "items": {101          "default": [],102          "items": {103            "$ref": "#/$defs/LineItem"104          },105          "title": "Items",106          "type": "array"107        },108        "amount": {109          "anyOf": [110            {111              "$ref": "#/$defs/AmountSpec"112            },113            {114              "type": "null"115            }116          ],117          "default": null118        },119        "payment": {120          "anyOf": [121            {122              "$ref": "#/$defs/PaymentInfo"123            },124            {125              "type": "null"126            }127          ],128          "default": null129        },130        "delivery": {131          "anyOf": [132            {133              "$ref": "#/$defs/DeliveryInfo"134            },135            {136              "type": "null"137            }138          ],139          "default": null140        },141        "tax": {142          "anyOf": [143            {144              "$ref": "#/$defs/TaxContext"145            },146            {147              "type": "null"148            }149          ],150          "default": null151        },152        "fx": {153          "anyOf": [154            {155              "$ref": "#/$defs/FxInfo"156            },157            {158              "type": "null"159            }160          ],161          "default": null162        },163        "related_event": {164          "anyOf": [165            {166              "type": "string"167            },168            {169              "type": "null"170            }171          ],172          "default": null,173          "title": "Related Event"174        },175        "meta": {176          "anyOf": [177            {178              "$ref": "#/$defs/Meta"179            },180            {181              "type": "null"182            }183          ],184          "default": null185        }186      },187      "required": [188        "id",189        "type",190        "date"191      ],192      "title": "EconomicEvent",193      "type": "object"194    },195    "EventType": {196      "enum": [197        "Sale",198        "Purchase",199        "Refund",200        "PaymentReceived",201        "PaymentSent",202        "OwnerContribution",203        "LoanReceived"204      ],205      "title": "EventType",206      "type": "string"207    },208    "FxInfo": {209      "additionalProperties": false,210      "description": "Observed FX data attached to the event (input data, not a rule).\n\nThe rate is a fact about the world (e.g. Bank of Canada daily rate on the\ntransaction date); it is provided by ingestion, never hardcoded in AIR/AIC.",211      "properties": {212        "rate": {213          "anyOf": [214            {215              "type": "number"216            },217            {218              "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",219              "type": "string"220            }221          ],222          "title": "Rate"223        },224        "source": {225          "title": "Source",226          "type": "string"227        },228        "rate_date": {229          "format": "date",230          "title": "Rate Date",231          "type": "string"232        }233      },234      "required": [235        "rate",236        "source",237        "rate_date"238      ],239      "title": "FxInfo",240      "type": "object"241    },242    "LineItem": {243      "additionalProperties": false,244      "properties": {245        "sku": {246          "anyOf": [247            {248              "type": "string"249            },250            {251              "type": "null"252            }253          ],254          "default": null,255          "title": "Sku"256        },257        "description": {258          "anyOf": [259            {260              "type": "string"261            },262            {263              "type": "null"264            }265          ],266          "default": null,267          "title": "Description"268        },269        "qty": {270          "anyOf": [271            {272              "type": "number"273            },274            {275              "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",276              "type": "string"277            }278          ],279          "default": "1",280          "title": "Qty"281        },282        "unit_price": {283          "$ref": "#/$defs/AmountSpec"284        }285      },286      "required": [287        "unit_price"288      ],289      "title": "LineItem",290      "type": "object"291    },292    "LlmInfo": {293      "additionalProperties": false,294      "properties": {295        "model": {296          "anyOf": [297            {298              "type": "string"299            },300            {301              "type": "null"302            }303          ],304          "default": null,305          "title": "Model"306        },307        "confidence": {308          "anyOf": [309            {310              "type": "number"311            },312            {313              "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",314              "type": "string"315            },316            {317              "type": "null"318            }319          ],320          "default": null,321          "title": "Confidence"322        },323        "reasoning_hash": {324          "anyOf": [325            {326              "type": "string"327            },328            {329              "type": "null"330            }331          ],332          "default": null,333          "title": "Reasoning Hash"334        }335      },336      "title": "LlmInfo",337      "type": "object"338    },339    "Meta": {340      "additionalProperties": false,341      "properties": {342        "source": {343          "anyOf": [344            {345              "$ref": "#/$defs/SourceInfo"346            },347            {348              "type": "null"349            }350          ],351          "default": null352        },353        "llm": {354          "anyOf": [355            {356              "$ref": "#/$defs/LlmInfo"357            },358            {359              "type": "null"360            }361          ],362          "default": null363        },364        "policy_version": {365          "anyOf": [366            {367              "type": "string"368            },369            {370              "type": "null"371            }372          ],373          "default": null,374          "title": "Policy Version"375        },376        "timestamps": {377          "anyOf": [378            {379              "$ref": "#/$defs/Timestamps"380            },381            {382              "type": "null"383            }384          ],385          "default": null386        },387        "approver": {388          "anyOf": [389            {390              "type": "string"391            },392            {393              "type": "null"394            }395          ],396          "default": null,397          "title": "Approver"398        }399      },400      "title": "Meta",401      "type": "object"402    },403    "PaymentInfo": {404      "additionalProperties": false,405      "properties": {406        "method": {407          "anyOf": [408            {409              "type": "string"410            },411            {412              "type": "null"413            }414          ],415          "default": null,416          "title": "Method"417        },418        "gross": {419          "anyOf": [420            {421              "$ref": "#/$defs/AmountSpec"422            },423            {424              "type": "null"425            }426          ],427          "default": null428        },429        "immediate": {430          "default": false,431          "title": "Immediate",432          "type": "boolean"433        }434      },435      "title": "PaymentInfo",436      "type": "object"437    },438    "SourceInfo": {439      "additionalProperties": false,440      "properties": {441        "kind": {442          "anyOf": [443            {444              "type": "string"445            },446            {447              "type": "null"448            }449          ],450          "default": null,451          "title": "Kind"452        },453        "uri": {454          "anyOf": [455            {456              "type": "string"457            },458            {459              "type": "null"460            }461          ],462          "default": null,463          "title": "Uri"464        },465        "ocr_score": {466          "anyOf": [467            {468              "type": "number"469            },470            {471              "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",472              "type": "string"473            },474            {475              "type": "null"476            }477          ],478          "default": null,479          "title": "Ocr Score"480        }481      },482      "title": "SourceInfo",483      "type": "object"484    },485    "TaxContext": {486      "additionalProperties": false,487      "description": "Where the supply takes place. Rates NEVER live here \u2014 they live in\nversioned ALSL policies; the compiler resolves jurisdiction \u2192 policy.",488      "properties": {489        "jurisdiction": {490          "title": "Jurisdiction",491          "type": "string"492        },493        "codes": {494          "default": [],495          "items": {496            "type": "string"497          },498          "title": "Codes",499          "type": "array"500        },501        "exempt": {502          "default": false,503          "title": "Exempt",504          "type": "boolean"505        }506      },507      "required": [508        "jurisdiction"509      ],510      "title": "TaxContext",511      "type": "object"512    },513    "Timestamps": {514      "additionalProperties": false,515      "properties": {516        "ingested": {517          "anyOf": [518            {519              "format": "date-time",520              "type": "string"521            },522            {523              "type": "null"524            }525          ],526          "default": null,527          "title": "Ingested"528        },529        "approved": {530          "anyOf": [531            {532              "format": "date-time",533              "type": "string"534            },535            {536              "type": "null"537            }538          ],539          "default": null,540          "title": "Approved"541        }542      },543      "title": "Timestamps",544      "type": "object"545    }546  },547  "additionalProperties": false,548  "description": "A batch of economic events (the compilation unit's input).",549  "properties": {550    "air_version": {551      "default": "0.1",552      "title": "Air Version",553      "type": "string"554    },555    "events": {556      "default": [],557      "items": {558        "$ref": "#/$defs/EconomicEvent"559      },560      "title": "Events",561      "type": "array"562    }563  },564  "type": "object"565}