pas

package
v0.1.23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package pas reads Da Vinci Prior Authorization Support (PAS) request Bundles.

It is the reader Perfuse's own PAS server uses, published so that whatever decides a prior authorization - a payer's rules, a utilization management system, a decision service such as Vaglio - reads a request with the same code, and so the same answers about what a request contains. Two readers of one message format are two opinions about it.

It has no dependencies outside the standard library. A request is kept as decoded JSON (map[string]any) rather than as typed resources, because a PAS Bundle carries whatever supporting resources the provider chose to send, and a reader that dropped what it did not model would hide evidence from the decision.

req, problems := pas.Read(bundle, false)
if len(problems) > 0 {
	// refuse: the request cannot be answered correctly
}
for _, svc := range req.Services() {
	// svc.Codes, svc.Item, and req.Resolve for anything the item references
}

Index

Constants

View Source
const Base = "http://hl7.org/fhir/us/davinci-pas/StructureDefinition/"

Base is the canonical base of the PAS StructureDefinitions.

View Source
const DataAbsentReason = "http://terminology.hl7.org/CodeSystem/data-absent-reason"

DataAbsentReason is the code system a CodeableConcept uses to say it has no value.

Variables

This section is empty.

Functions

func Map

func Map(v any) map[string]any

Map is v as a JSON object. Anything else is an empty object, never nil, so a chain of lookups into a sparse resource reads as absent rather than panicking.

func Slice

func Slice(v any) []any

Slice is v as a JSON array, or nil.

func Str

func Str(v any) string

Str is v as a JSON string, or "".

func UsableCode

func UsableCode(cc map[string]any) bool

UsableCode reports whether a CodeableConcept names something, rather than saying it has no code.

Types

type Request

type Request struct {
	Bundle   map[string]any
	Claim    map[string]any
	ClaimURL string // fullUrl of the Claim's entry, the base relative references resolve against
	Entries  []map[string]any
}

Request is a PAS request Bundle, read: its Claim and how its references resolve.

func Read

func Read(b map[string]any, inquiry bool) (*Request, []string)

Read checks what is needed to answer a request and reports everything missing at once. It does not repeat the profile validation a client should have done; it refuses what could not be answered correctly.

inquiry relaxes the requirement that the Claim have items, which a $inquire does not need. A nil Request means the Bundle could not be read at all; a Request with problems was read but must not be answered.

func (*Request) Resolve

func (r *Request) Resolve(ref string) map[string]any

Resolve finds the entry a reference names: by fullUrl, or relative to the Claim's base as FHIR resolves a relative reference inside a Bundle. It returns the entry, not the resource, so a caller can cite the entry's fullUrl.

func (*Request) Resources

func (r *Request) Resources(resourceType string) []map[string]any

Resources returns every resource in the Bundle of the given type, with the entry each came from.

func (*Request) Service

func (r *Request) Service(sequence string) (Service, bool)

Service returns the item with the given sequence.

func (*Request) ServiceCodes

func (r *Request) ServiceCodes(item map[string]any) []map[string]any

ServiceCodes returns what an item says it is: its productOrService, and the code of every order its requestedService extension references. A CodeableConcept that says it has no code (a data-absent-reason) is not a code.

func (*Request) Services

func (r *Request) Services() []Service

Services returns every item of the Claim, in order.

type Service

type Service struct {
	Sequence string           // Claim.item.sequence, as text
	Item     map[string]any   // the Claim.item itself
	Codes    []map[string]any // CodeableConcepts naming the service; empty when the item names none
}

Service is one requested service: a Claim item and the codes that say what it is.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL