resource

package
v0.0.0-...-db2c1db Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package resource contains functionality for generating resources from PatientInfo.

Index

Constants

View Source
const (
	// Batch denotes the transaction bundle type: intended to be processed by a server as a group of
	// independent actions.
	// Reference: http://hl7.org/fhir/valueset-bundle-type.html
	Batch = "BATCH"
	// Collection denotes the collection bundle type: a set of resources collected into a single
	// document for ease of distribution.
	// Reference: http://hl7.org/fhir/valueset-bundle-type.html
	Collection = "COLLECTION"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DirectoryOutput

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

DirectoryOutput is a resource output that stores information in multiple files in the same directory. Each file stores resources for a single patient at a specific point in time. Files are never updated.

func NewDirectoryOutput

func NewDirectoryOutput(path string) (*DirectoryOutput, error)

NewDirectoryOutput returns a new DirectoryOutput based on the given path.

func (*DirectoryOutput) New

New returns a new file as a writer for the given patient. It generates filenames as the concatenation of the person's full name and MRN (to avoid the slim possibility of collisions). If resources are generated more than once for the same Patient, a suffix is added. Consecutive writes will append to the file.

type FHIRWriter

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

FHIRWriter generates FHIR resources as protocol buffers, and writes them to writer.

func NewFHIRWriter

func NewFHIRWriter(cfg GeneratorConfig) (*FHIRWriter, error)

NewFHIRWriter constructs and returns a new FHIRWriter.

func (*FHIRWriter) Close

func (w *FHIRWriter) Close() error

Close closes the FHIRWriter.

func (*FHIRWriter) Generate

func (w *FHIRWriter) Generate(p *ir.PatientInfo) error

Generate generates FHIR resources from PatientInfo.

type GeneratorConfig

type GeneratorConfig struct {
	Writer      io.Writer
	HL7Config   *config.HL7Config
	IDGenerator id.Generator
	Output      Output
	Marshaller  Marshaller
	// BundleType is the type of bundle to generate, and defaults to Batch if unspecified.
	BundleType string
}

GeneratorConfig is the configuration for resource generators.

type JSONMarshaller

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

JSONMarshaller is a resource.Marshaller that wraps jsonformat.Marshaller.

func NewJSONMarshaller

func NewJSONMarshaller() (*JSONMarshaller, error)

NewJSONMarshaller creates and returns a new JSONMarshaller.

func (*JSONMarshaller) Marshal

func (m *JSONMarshaller) Marshal(message proto.Message) ([]byte, error)

Marshal marshalls the given FHIR protocol buffer message as JSON.

type Marshaller

type Marshaller interface {
	Marshal(proto.Message) ([]byte, error)
}

Marshaller defines an object that can marshal a protocol buffer message.

type Output

type Output interface {
	New(*ir.PatientInfo) (io.WriteCloser, error)
}

Output defines an object which returns a writer that resource are written to.

type StdOutput

type StdOutput struct{}

StdOutput is a resource output that wraps stdout.

func (*StdOutput) New

New just returns os.Stdout.

Directories

Path Synopsis
Package cloud contains functionality to write to a Cloud FHIR store.
Package cloud contains functionality to write to a Cloud FHIR store.

Jump to

Keyboard shortcuts

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