FHIR Billing Engine API reference
Generated from the TypeScript declarations published in @cognovis/fhir-billing-engine 0.42.4, the version the npm dist-tag latest named at render time. FHIR Billing Engine · All SDKs.
Entry points
@cognovis/fhir-billing-engine
Declarations marked from come from @cognovis/fhir-billing-rules 0.42.4, @cognovis/fhir-billing-types 0.42.4, the latest version that satisfies this package's dependency range at render time.
- BillingInputError class
- BILLING_CONFORMANCE_FORMAT const
- BILLING_CONFORMANCE_INPUT_INVALID const
- BillingConformanceBlockingPair interface
- BillingConformanceDecision type
- BillingConformanceDifference type
- BillingConformanceFinding interface
- BillingConformanceRecord interface
- BillingConformanceRuleSetIdentity interface
- BillingConformanceSide interface
- BillingReasonResolution interface
- BillingResolutionCode interface
- BILLING_ENGINE_VERSION const
- BILLING_ENGINE_CAPABILITY const
- compileRuleSet function
- evaluateBillingCase function
- BillingFinding interface
- evaluateBillingCaseFindings function
- EvaluateConformanceCasesInput interface
- evaluateConformanceCases function
- compareConformanceRecords function
- toOracleParameters function
- CatalogPriceTable interface
- resolveCatalogUnitPrices function
BillingInputError class from @cognovis/fhir-billing-rules 0.42.4
class BillingInputError extends TypeError {
readonly code = "BILLING_INPUT_INVALID";
readonly cause?: BillingInputErrorCause;
constructor(message: string, options?: {
readonly cause?: BillingInputErrorCause;
});
}
BILLING_CONFORMANCE_FORMAT const from @cognovis/fhir-billing-types 0.42.4
Line format of a standalone conformance record; one canonical JSON record per line.
const BILLING_CONFORMANCE_FORMAT: "fhir-billing-conformance/1";
BILLING_CONFORMANCE_INPUT_INVALID const from @cognovis/fhir-billing-types 0.42.4
Record-format code for a case the engine cannot read; it is not a `BillingReasonCode`.
const BILLING_CONFORMANCE_INPUT_INVALID: "BILLING_INPUT_INVALID";
BillingConformanceBlockingPair interface from @cognovis/fhir-billing-types 0.42.4
A blocking pair is a finding with effect `reject`, identified by its line and rule.
interface BillingConformanceBlockingPair {
lineId?: string;
ruleId?: string;
}
BillingConformanceDecision type from @cognovis/fhir-billing-types 0.42.4
type BillingConformanceDecision = 'allow' | 'block' | 'unavailable';
BillingConformanceDifference type from @cognovis/fhir-billing-types 0.42.4
type BillingConformanceDifference = {
kind: 'disagree';
caseId: string;
differs: readonly ('decision' | 'blocking')[];
left: BillingConformanceSide;
right: BillingConformanceSide;
} | {
kind: 'left-only';
caseId: string;
left: BillingConformanceSide;
} | {
kind: 'right-only';
caseId: string;
right: BillingConformanceSide;
};
BillingConformanceFinding interface from @cognovis/fhir-billing-types 0.42.4
interface BillingConformanceFinding {
code: BillingReasonCode | typeof BILLING_CONFORMANCE_INPUT_INVALID;
ruleId?: string;
lineId?: string;
effect: BillingRuleEffect;
details?: Readonly<Record<string, string | number | boolean>>;
/** The reason's resolution, unchanged; comparison ignores it. */
resolution?: BillingReasonResolution;
/** The producing rule's provenance sources and evidence level, unchanged; comparison ignores them. */
sources?: readonly BillingRuleSource[];
evidenceLevel?: Coding;
}
BillingConformanceRecord interface from @cognovis/fhir-billing-types 0.42.4
One case evaluated against one rule set without a tenant, a catalog edition or a FHIR server. `mode: 'standalone'` marks it as a conformance result, never an admitted production verdict.
interface BillingConformanceRecord {
format: typeof BILLING_CONFORMANCE_FORMAT;
mode: 'standalone';
caseId: string;
decision: BillingConformanceDecision;
ruleSet: BillingConformanceRuleSetIdentity;
engineVersion: typeof BILLING_CORE_VERSION;
/** Rules of an unsupported class without mustUnderstand that the engine skipped; sorted, absent when none. */
ignoredRuleIds?: readonly string[];
advisories?: readonly BillingReason[];
findings: readonly BillingConformanceFinding[];
}
BillingConformanceRuleSetIdentity interface from @cognovis/fhir-billing-types 0.42.4
interface BillingConformanceRuleSetIdentity {
id: string;
digest: string;
/** Library.url and Library.version, present only when the rule set was given as a rule-set Library. */
canonical?: string;
version?: string;
/** Library.publisher of a rule-set Library that names one; comparison ignores it. */
publisher?: string;
}
BillingConformanceSide interface from @cognovis/fhir-billing-types 0.42.4
interface BillingConformanceSide {
decision: BillingConformanceDecision;
blocking: readonly BillingConformanceBlockingPair[];
}
BillingReasonResolution interface from @cognovis/fhir-billing-types 0.42.4
The codes that would resolve a block reason: `add-one-of` means any one of `codes` satisfies the rule, `remove` means the listed present codes caused, or may have caused, the block. Codes are unique and keep their first position. It informs a UI and never changes a decision.
interface BillingReasonResolution {
readonly action: 'add-one-of' | 'remove';
readonly codes: readonly BillingResolutionCode[];
}
BillingResolutionCode interface from @cognovis/fhir-billing-types 0.42.4
A coding a reason resolution names. `lineId` identifies the present line that carries it; on a `MUTUALLY_EXCLUSIVE_CODE_PRESENT` reason a `lineId` equal to the reason's own `lineId` means that line matches the `excluded` selector itself, so removing it is the only fix that resolves the reason. `qualifiers` is set only on an `add-one-of` code whose admissible member declares qualifiers: the code satisfies the rule with one of the listed values for every listed qualifier.
interface BillingResolutionCode {
readonly system?: string;
readonly code: string;
readonly lineId?: string;
readonly qualifiers?: Readonly<Record<string, readonly (string | number | boolean | null)[]>>;
}
BILLING_ENGINE_VERSION const
const BILLING_ENGINE_VERSION: "0.42.0";
BILLING_ENGINE_CAPABILITY const
const BILLING_ENGINE_CAPABILITY: {
readonly semanticMajors: readonly [4];
readonly payloadSchemas: readonly [2];
readonly precision: "exact-decimal";
readonly ordering: "priority-then-id";
};
compileRuleSet function
function compileRuleSet(ruleSet: BillingRuleSet, admission: AdmissionState): CompiledRuleSet;
evaluateBillingCase function
function evaluateBillingCase(compiled: CompiledRuleSet, input: BillingCase): BillingResult;
BillingFinding interface
One reason of a result with the effect the engine gave it: `reject` blocks, `needs-review` leaves the case undecided.
interface BillingFinding {
readonly reason: BillingReason;
readonly effect: 'reject' | 'needs-review';
}
evaluateBillingCaseFindings function
evaluateBillingCase with the effect of each reason. A rule's finding does not always carry the rule's `effect` (for example `ACTUAL_MULTIPLIER_UNAVAILABLE` of a rejecting rule, or a `bounded-multiplier` finding above `standardThreshold` with `aboveThresholdEffect`), so a caller that combines several results reads the effect here instead of inferring it. Admission reasons are `needs-review` findings. `result` is exactly what `evaluateBillingCase` returns.
function evaluateBillingCaseFindings(compiled: CompiledRuleSet, input: BillingCase): {
result: BillingResult;
findings: readonly BillingFinding[];
};
EvaluateConformanceCasesInput interface
interface EvaluateConformanceCasesInput {
/** A rule-set `Library` carrier (decoded and digest-checked) or a bare `BillingRuleSet` payload. */
ruleSet: unknown;
/** Cases in input order; an unreadable case becomes an `unavailable` record instead of aborting the run. */
cases: readonly unknown[];
}
evaluateConformanceCases function
Evaluates one rule set on synthetic cases without a FHIR server, a catalog edition or a tenant. A malformed, digest-mismatched or unsupported rule set throws before any record; a case the engine cannot read yields an `unavailable` record with `BILLING_INPUT_INVALID`, and the run continues.
function evaluateConformanceCases(input: EvaluateConformanceCasesInput): readonly BillingConformanceRecord[];
compareConformanceRecords function
Compares two engines' conformance records case by case. A case disagrees when the decisions differ or the sets of blocking `(lineId, ruleId)` pairs differ; reason codes, review findings and unknown fields are not compared, so records of another engine are accepted. Differences are sorted by caseId.
function compareConformanceRecords(left: readonly unknown[], right: readonly unknown[]): readonly BillingConformanceDifference[];
toOracleParameters function
function toOracleParameters(fixture: OracleFixture, result: BillingResult): FhirParameters;
CatalogPriceTable interface
The unit prices of an admitted catalog edition. An entry carries exactly one of `unitPrice` and `unitPriceUnknown: true`; the latter is a definition with points but no amount. `currency` is the currency of every entry with a unit price, and may be absent only when no entry has one.
interface CatalogPriceTable {
edition: string;
digest: string;
currency?: string;
prices: readonly {
system: string;
code: string;
unitPrice?: string;
unitPriceUnknown?: true;
}[];
}
resolveCatalogUnitPrices function
Fills each catalog-priced line from the table: a line with a numeric-zero placeholder or the `unitPriceUnknown` marker takes its entry's unit price, or becomes `unitPriceUnknown: true` when the entry has points only. A line with a non-zero unit price keeps it.
function resolveCatalogUnitPrices(input: BillingCase, prices: CatalogPriceTable, admission: AdmissionState): BillingCase;