conceptmap

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package conceptmap resolves FHIR ConceptMap resources and translates source codings through map groups for StructureMap translate transforms.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Canonical

func Canonical(m Map) string

func ErrNotFound

func ErrNotFound(canonical string) error

ErrNotFound reports a missing ConceptMap canonical URL.

func IsNoMap

func IsNoMap(err error) bool

IsNoMap reports whether err is a ConceptMap no-map element.

func IsNoTranslation

func IsNoTranslation(err error) bool

IsNoTranslation reports whether err is a missing acceptable translation.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound reports whether err indicates the ConceptMap canonical URL was not found.

Types

type ChainResolver

type ChainResolver struct {
	Resolvers []Resolver
}

ChainResolver tries resolvers in order until one succeeds.

func (ChainResolver) Resolve

func (c ChainResolver) Resolve(ctx context.Context, canonical string) (Map, error)

type Element

type Element struct {
	Code    string   `json:"code,omitempty"`
	Display string   `json:"display,omitempty"`
	NoMap   bool     `json:"noMap,omitempty"`
	Target  []Target `json:"target,omitempty"`
}

type Group

type Group struct {
	Source   string    `json:"source,omitempty"`
	Target   string    `json:"target,omitempty"`
	Element  []Element `json:"element,omitempty"`
	Unmapped *Unmapped `json:"unmapped,omitempty"`
}

type Map

type Map struct {
	ResourceType string  `json:"resourceType"`
	URL          string  `json:"url"`
	Version      string  `json:"version,omitempty"`
	Status       string  `json:"status,omitempty"`
	Name         string  `json:"name,omitempty"`
	SourceURI    string  `json:"sourceUri,omitempty"`
	Group        []Group `json:"group,omitempty"`
}

Map is the JSON representation of a FHIR ConceptMap resource.

func ParseMap

func ParseMap(raw []byte) (Map, error)

func ResolveEnvelope

func ResolveEnvelope(env *types.ResourceEnvelope) (Map, error)

ResolveEnvelope parses a ConceptMap envelope.

type RemoteHTTPClient

type RemoteHTTPClient struct {
	BaseURL    string
	HTTPClient *http.Client
	Headers    map[string]string
	Authorize  func(*http.Request) error
}

RemoteHTTPClient calls a FHIR server's ConceptMap/$translate operation.

func (RemoteHTTPClient) Translate

func (c RemoteHTTPClient) Translate(ctx context.Context, req TranslateRequest) ([]map[string]any, error)

Translate performs a remote ConceptMap/$translate request.

type RemoteTranslateClient

type RemoteTranslateClient interface {
	Translate(ctx context.Context, req TranslateRequest) ([]map[string]any, error)
}

RemoteTranslateClient performs ConceptMap translation against an external terminology server.

type Resolver

type Resolver interface {
	Resolve(ctx context.Context, canonical string) (Map, error)
}

Resolver loads ConceptMap resources by canonical URL.

type StaticResolver

type StaticResolver map[string]Map

StaticResolver resolves maps from an in-memory table.

func (StaticResolver) Resolve

func (r StaticResolver) Resolve(_ context.Context, canonical string) (Map, error)

type StoreResolver

type StoreResolver struct {
	Resources store.ResourceStore
	Registry  store.DefinitionStore
	// contains filtered or unexported fields
}

StoreResolver resolves ConceptMaps from ResourceStore with DefinitionStore fallback.

func (*StoreResolver) Resolve

func (r *StoreResolver) Resolve(ctx context.Context, canonical string) (Map, error)

type Target

type Target struct {
	Code         string `json:"code,omitempty"`
	Display      string `json:"display,omitempty"`
	Equivalence  string `json:"equivalence,omitempty"`
	Relationship string `json:"relationship,omitempty"`
}

type TerminologyStoreResolver

type TerminologyStoreResolver struct {
	Store   store.TerminologyStore
	ScopeID string
}

TerminologyStoreResolver resolves ConceptMaps from a terminology store projection.

func (*TerminologyStoreResolver) Resolve

func (r *TerminologyStoreResolver) Resolve(ctx context.Context, canonical string) (Map, error)

type TranslateRequest

type TranslateRequest struct {
	MapCanonical string
	Source       map[string]any
	TargetSystem string
}

TranslateRequest identifies a source coding and ConceptMap to apply.

type Translator

type Translator struct {
	Resolver Resolver
	Remote   RemoteTranslateClient
}

Translator translates source codings using ConceptMap resources.

func (Translator) Translate

func (t Translator) Translate(ctx context.Context, req TranslateRequest) ([]map[string]any, error)

Translate returns target codings for a source coding.

func (Translator) TranslateResolved

func (t Translator) TranslateResolved(ctx context.Context, req TranslateRequest) ([]map[string]any, Map, error)

TranslateResolved is Translate plus the ConceptMap that was resolved for provenance.

type Unmapped

type Unmapped struct {
	Mode    string `json:"mode,omitempty"`
	Code    string `json:"code,omitempty"`
	Display string `json:"display,omitempty"`
}

Jump to

Keyboard shortcuts

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