conceptmap

package
v0.0.0-...-4aff210 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

internal/fhir/conceptmap/converter.go

internal/fhir/conceptmap/types.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CSVMapping

type CSVMapping struct {
	SourceSystem  string
	SourceCode    string
	SourceDisplay string
	TargetSystem  string
	TargetCode    string
	TargetDisplay string
	IsValid       bool
	ValueSetURI   string
}

CSVMapping represents a row in a concept mapping CSV file

type ConceptMapConverter

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

ConceptMapConverter handles conversion of mapping files to FHIR ConceptMaps

func NewConceptMapConverter

func NewConceptMapConverter(log zerolog.Logger, conceptMapService *ConceptMapService) *ConceptMapConverter

NewConceptMapConverter creates a new converter instance

func (*ConceptMapConverter) ConvertCSVToFHIR

func (c *ConceptMapConverter) ConvertCSVToFHIR(reader io.Reader, name string) (*fhir.ConceptMap, error)

ConvertCSVToFHIR maintains backwards compatibility while using the repository structure

func (*ConceptMapConverter) ConvertCSVToFHIRAndSave

func (c *ConceptMapConverter) ConvertCSVToFHIRAndSave(reader io.Reader, csvName string, repository *ConceptMapRepository, usePrefix bool) error

ConvertCSVToFHIRAndSave converts a CSV file to a FHIR ConceptMap and saves it to the repository's converted folder

func (*ConceptMapConverter) ConvertFolderToFHIR

func (c *ConceptMapConverter) ConvertFolderToFHIR(inputFolder string, repository *ConceptMapRepository, usePrefix bool) error

ConvertFolderToFHIR converts all CSV files in a folder to FHIR ConceptMaps

type ConceptMapMetadata

type ConceptMapMetadata struct {
	ID          string
	Version     string
	LastUpdated time.Time
	SourceURI   string
	TargetURI   string
	ConceptMap  *fhir.ConceptMap
}

ConceptMapMetadata contains metadata about a stored ConceptMap ConceptMapMetadata contains metadata about a stored ConceptMap

type ConceptMapRepository

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

ConceptMapRepository handles loading and storing ConceptMap resources.

func NewConceptMapRepository

func NewConceptMapRepository(localPath string, log zerolog.Logger) *ConceptMapRepository

NewConceptMapRepository creates a new ConceptMapRepository.

func (*ConceptMapRepository) GetConceptMap

func (repo *ConceptMapRepository) GetConceptMap(url string) (*fhir.ConceptMap, error)

GetConceptMap retrieves a ConceptMap by ID or URL.

func (*ConceptMapRepository) GetConceptMapFileNameByURL

func (repo *ConceptMapRepository) GetConceptMapFileNameByURL(url string) (string, error)

GetConceptMapFileNameByURL returns the filename of a ConceptMap based on its URL

func (*ConceptMapRepository) GetConceptMapsByValuesetURL

func (repo *ConceptMapRepository) GetConceptMapsByValuesetURL(valueSetURL string) ([]string, error)

GetConceptMapsByValuesetURL retrieves all ConceptMaps with a target URI matching the input URL.

func (*ConceptMapRepository) LoadConceptMaps

func (repo *ConceptMapRepository) LoadConceptMaps() error

LoadConceptMaps loads all ConceptMaps into the repository.

type ConceptMapService

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

ConceptMapService provides functionality to interact with ConceptMap resources.

func NewConceptMapService

func NewConceptMapService(repo *ConceptMapRepository, log zerolog.Logger) *ConceptMapService

NewConceptMapService creates a new ConceptMapService.

func (*ConceptMapService) CreateConceptMap

func (s *ConceptMapService) CreateConceptMap(id string, name string, sourceValueSet string, targetValueSet string) *fhir.ConceptMap

func (*ConceptMapService) GetConceptMapsByValuesetURL

func (svc *ConceptMapService) GetConceptMapsByValuesetURL(valueSetURL string) ([]string, error)

func (*ConceptMapService) GetRepository

func (s *ConceptMapService) GetRepository() *ConceptMapRepository

GetRepository returns the ConceptMapRepository

func (*ConceptMapService) SaveConceptMap

func (s *ConceptMapService) SaveConceptMap(outputPath string, cm *fhir.ConceptMap) error

func (*ConceptMapService) TranslateCode

func (s *ConceptMapService) TranslateCode(conceptMapURLs []string, sourceCode string, typeIsCode bool) (*TranslationResult, error)

type TranslationResult

type TranslationResult struct {
	TargetCode    string
	TargetDisplay string
}

TranslationResult represents the result of code translation

type ValidationResult

type ValidationResult struct {
	Valid        bool
	MatchedIn    string // Which ValueSet contained the match
	ErrorMessage string
}

ValidationResult represents the result of code validation against a ValueSet

Jump to

Keyboard shortcuts

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