harmonizecode

package
v0.0.0-...-e9b43fb Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Overview

Package harmonizecode handles harmonization of codes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadCodeHarmonizationProjectors

func LoadCodeHarmonizationProjectors(r *types.Registry, hc *hpb.CodeHarmonizationConfig) error

LoadCodeHarmonizationProjectors loads all harmonization projectors.

Types

type CodeHarmonizer

type CodeHarmonizer interface {
	// sourceCode is the code being translated.
	// sourceSystem is the system that this code belongs to.
	// sourceName is the name of the concept map to use.
	Harmonize(sourceCode, sourceSystem, sourceName string) ([]HarmonizedCode, error)
	// sourceCode is the code being translated.
	// sourceSystem is the system that this code belongs to.
	// targetSystem is the system in which a translated code is sought.
	// sourceName is the name of the concept map to use.
	HarmonizeWithTarget(sourceCode, sourceSystem, targetSystem, sourceName string) ([]HarmonizedCode, error)
	// sourceCode is the code being translated.
	// sourceSystem is the system that this code belongs to.
	// sourceValueset is the name of the source value set to search by.
	// targetValueset is the name of the target value set to search by.
	// version is the version of the concept map to use.
	HarmonizeBySearch(sourceCode, sourceSystem, sourceValueset, targetValueset, version string) ([]HarmonizedCode, error)
}

CodeHarmonizer is the interface for harmonizing codes.

type CodeLookupKey

type CodeLookupKey struct {
	Code    string
	System  string
	Version string
}

CodeLookupKey is the key to look for in the cache.

type CodeLookupValue

type CodeLookupValue struct {
	// contains filtered or unexported fields
}

CodeLookupValue stores the cached values.

type ConceptElement

type ConceptElement struct {
	Code   string
	Target []ConceptElementTarget
}

ConceptElement (and the nested structs) represents a slimmed-down, multiversion representation of a FHIR Element within a ConceptMap > Group.

type ConceptElementTarget

type ConceptElementTarget struct {
	Code, Display string
}

ConceptElementTarget represents a slimmed-down, multiversion representation of a FHIR Target within a ConceptMap > Group > Element.

type ConceptGroup

type ConceptGroup struct {
	Element  []ConceptElement
	Unmapped *ConceptUnmapped
	Target   string
	Source   string
}

ConceptGroup (and the nested structs) represents a slimmed-down, multiversion representation of a FHIR Group within a ConceptMap resource.

type ConceptMap

type ConceptMap struct {
	ID, Version, ResourceType string
	Group                     []ConceptGroup
}

ConceptMap (and the nested structs) represents a slimmed-down, multiversion representation of a FHIR ConceptMap.

type ConceptUnmapped

type ConceptUnmapped struct {
	Code, Display, Mode string
}

ConceptUnmapped represents a slimmed-down, multiversion representation of a FHIR Unmapped within a ConceptMap > Group.

type ExpiringCache

type ExpiringCache struct {
	// contains filtered or unexported fields
}

ExpiringCache contains a sync.Map and implements read through cache functionalities.

func NewCache

func NewCache(ttl int, cleanup int) *ExpiringCache

NewCache creates a new expiring cache with specified TTL and cleanup interval in seconds.

func (*ExpiringCache) Get

Get retrieves a value from the ExpiringCache by key, only if the value has not yet expired.

func (*ExpiringCache) Len

func (m *ExpiringCache) Len() int

Len returns the length of a sync.Map.

func (*ExpiringCache) Put

func (m *ExpiringCache) Put(key CodeLookupKey, val []HarmonizedCode)

Put adds an array of harmonized codes into the cache with a timestamp.

type HarmonizedCode

type HarmonizedCode struct {
	Code    string
	System  string
	Display string
	Version string
}

HarmonizedCode is the result of harmonization. TODO(): Add original code and equivalence here.

func FromJSONContainer

func FromJSONContainer(jc jsonutil.JSONContainer) (HarmonizedCode, error)

FromJSONContainer converts a JSONContainer to a HarmonizedCode.

func (HarmonizedCode) ToJSONContainer

func (h HarmonizedCode) ToJSONContainer() jsonutil.JSONContainer

ToJSONContainer converts the HarmonizedCode to a JSONContainer.

type LocalCodeHarmonizer

type LocalCodeHarmonizer struct {
	// contains filtered or unexported fields
}

LocalCodeHarmonizer will harmonize codes using files stored locally.

func NewLocalCodeHarmonizer

func NewLocalCodeHarmonizer() *LocalCodeHarmonizer

NewLocalCodeHarmonizer instantiates a new LocalCodeHarmonizer.

func (*LocalCodeHarmonizer) Cache

func (h *LocalCodeHarmonizer) Cache(cm *ConceptMap) error

Cache takes a conceptMap and caches it internally for lookups.

func (*LocalCodeHarmonizer) Harmonize

func (h *LocalCodeHarmonizer) Harmonize(sourceCode, sourceSystem, sourceName string) ([]HarmonizedCode, error)

Harmonize implements CodeHarmonizer's Harmonize function.

func (*LocalCodeHarmonizer) HarmonizeBySearch

func (h *LocalCodeHarmonizer) HarmonizeBySearch(sourceCode, sourceSystem, sourceValueset, targetValueset, version string) ([]HarmonizedCode, error)

HarmonizeBySearch implements CodeHarmonizer's HarmonizeBySearch function.

func (*LocalCodeHarmonizer) HarmonizeWithTarget

func (h *LocalCodeHarmonizer) HarmonizeWithTarget(sourceCode, sourceSystem, targetSystem, sourceName string) ([]HarmonizedCode, error)

HarmonizeWithTarget implements CodeHarmonizer's HarmonizeWithTarget function.

type ParamParameter

type ParamParameter struct {
	Name        string
	Part        []ParamParameter
	ValueCoding ParamValueCoding
}

ParamParameter (and the nested structs) represents a slimmed-down, multiversion representation of a FHIR Parameter resource within a Parameters resource.

type ParamValueCoding

type ParamValueCoding struct {
	Code, System, Version, Display string
}

ParamValueCoding represents a multiversion representation of a FHIR Coding resource when used as the type for the Value field of a Parameter resource.

type Parameters

type Parameters struct {
	ResourceType string
	Parameter    []ParamParameter
}

Parameters (and the nested structs) represents a slimmed-down, multiversion representation of a FHIR Parameters resource.

type RemoteCodeHarmonizer

type RemoteCodeHarmonizer struct {
	// contains filtered or unexported fields
}

RemoteCodeHarmonizer will harmonize codes using a remote lookup service.

func (*RemoteCodeHarmonizer) Harmonize

func (h *RemoteCodeHarmonizer) Harmonize(sourceCode, sourceSystem, sourceName string) ([]HarmonizedCode, error)

Harmonize implements CodeHarmonizer's Harmonize function.

func (*RemoteCodeHarmonizer) HarmonizeBySearch

func (h *RemoteCodeHarmonizer) HarmonizeBySearch(sourceCode, sourceSystem, sourceValueset, targetValueset, version string) ([]HarmonizedCode, error)

HarmonizeBySearch implements CodeHarmonizer's HarmonizeBySearch function.

func (*RemoteCodeHarmonizer) HarmonizeWithTarget

func (h *RemoteCodeHarmonizer) HarmonizeWithTarget(sourceCode, sourceSystem, targetSystem, sourceName string) ([]HarmonizedCode, error)

HarmonizeWithTarget implements CodeHarmonizer's HarmonizeWithTarget function.

Jump to

Keyboard shortcuts

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