Skip to content

Public calculator contract

The public calculator contract is the runtime-neutral boundary that adapters and delivery surfaces must consume. It is intentionally narrow so the public docs can explain what the calculator accepts and returns without duplicating formula logic.

Contract version

Version 1.0 is the current public contract baseline.

Calculator identifiers

Stable lower-case names such as acute identify the calculator surface.

Pricing years

Use the four-digit IHACPA label form, for example 2025.

The contract is batch-first. Adapters accept a batch envelope and return a batch result envelope. The row payloads stay runtime-neutral so Python, Rust, and future bindings can share the same public shape.

  • calculator: lower-case calculator identifier such as acute.
  • pricing_year: four-digit IHACPA year label such as 2025.
  • rows: array of input row objects.
  • reference: year-scoped reference values required by the calculator.
  • adjustments: batch-scoped adjustment inputs or override factors.

Each row must include the required input columns for the requested calculator. Adapters may ignore extra fields only when those fields do not affect contract validation.

  • calculator
  • pricing_year
  • results: row-aligned outputs, including any row-level validation errors.
  • batch_errors: non-row-scoped errors such as unsupported calculators, missing reference bundles, or contract-level failures.
  • DRG
  • LOS
  • ICU_HOURS
  • ICU_OTHER
  • PAT_SAMEDAY_FLAG
  • PAT_PRIVATE_FLAG
  • NWAU25 for pricing year 2025
  • Contract violations should surface structured, explainable errors.
  • Missing or invalid contract values should be rejected during contract construction.
  • Missing input or output columns should surface explicit boundary errors.

Adapters should map contract failures into stable, machine-readable codes and preserve the field path or row index whenever they can.

Contract conditionSuggested codeNotes
Missing required batch field or row columnmissing_required_fieldInclude the field path and row index.
Value has the wrong type or formatinvalid_valueInclude the field path and expected shape.
Calculator is not supportedunsupported_calculatorUse before any core execution starts.
Pricing year is not supportedunsupported_pricing_yearUse when the year is outside the published contract surface.
Required reference data is missingmissing_reference_bundleUse when the adapter cannot resolve the shared reference payload.
Rust path is present but not opted inexperimental_calculator_disabledKeep the Python fallback available.
Core execution raises an unexpected failureinternal_calculator_errorKeep stack traces out of user-facing docs.

Adapters may parse inputs, validate the contract, select the requested year, and format outputs.

Adapters must not:

  • embed calculator math,
  • hide source-bundle lookup behavior, or
  • change the core schema for different delivery surfaces.

This same contract should remain consumable by Rust, Python, C#, web, Power Platform, R, Julia, Go, and TypeScript surfaces without changing the core schema.

This contract shape is a good candidate for later OpenAPI or client model generation because it already exposes explicit schema versions, supported identifiers, required columns, and structured validation errors.

The machine-readable schema is published alongside this page at /contracts/public-calculator-contract.v1.schema.json.