models2

package
v0.0.0-...-838d5f2 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2020 License: Apache-2.0 Imports: 22 Imported by: 4

Documentation

Index

Constants

View Source
const Gofhir__from = "__from"
View Source
const Gofhir__num = "__num"
View Source
const Gofhir__strDate = "__strDate"
View Source
const Gofhir__strNum = "__strNum"
View Source
const Gofhir__to = "__to"

Variables

This section is empty.

Functions

func AllFhirResourceCollectionNames

func AllFhirResourceCollectionNames() []string

func ConvertGoFhirBSONToJSON

func ConvertGoFhirBSONToJSON(bsonDoc []bson.E) (jsonBytes []byte, includedDocsJsons [][]byte, err error)

Reverses transformations done by ConvertJsonToGoFhirBSON

func ConvertJsonToGoFhirBSON

func ConvertJsonToGoFhirBSON(jsonBytes []byte, whatToEncrypt WhatToEncrypt, transformReferencesMap map[string]string) (out bson.D, err error)

Converts a FHIR JSON Resource into BSON for storage in MongoDB Does several transformations:

  • re-writes references (for transactions)
  • converts id to _id and puts first (_id converted to __id)
  • converts extensions from { url, value } to { url: { value } } to enable better MongoDB queries
  • converts decimal numbers to { __from, __to, __num, __strNum } for FHIR conformance
  • converts dates to { __from, __to, __strDate } for FHIR conformance
  • optionally encrypts certain fields

func WalkFHIRjson

func WalkFHIRjson(jsonBytes []byte, visitor FhirVisitor) (err error)

Types

type FhirSchemaError

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

func (FhirSchemaError) Error

func (e FhirSchemaError) Error() string

type FhirVisitor

type FhirVisitor interface {
	String(pos positionInfo, value string) error
	Reference(pos positionInfo, value string) error
	Date(pos positionInfo, value string) error
	Instant(pos positionInfo, value string) error
	Decimal(pos positionInfo, value string) error
	Number(pos positionInfo, value string) error
	Bool(pos positionInfo, value bool) error
	Null(pos positionInfo) error

	Extension(pos positionInfo, url string) error
}

type FhirVisitorCollectReferences

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

func NewFhirVisitorCollectReferences

func NewFhirVisitorCollectReferences() *FhirVisitorCollectReferences

func (*FhirVisitorCollectReferences) Bool

func (v *FhirVisitorCollectReferences) Bool(pos positionInfo, value bool) error

func (*FhirVisitorCollectReferences) Date

func (v *FhirVisitorCollectReferences) Date(pos positionInfo, value string) error

func (*FhirVisitorCollectReferences) Decimal

func (v *FhirVisitorCollectReferences) Decimal(pos positionInfo, value string) error

func (*FhirVisitorCollectReferences) Extension

func (v *FhirVisitorCollectReferences) Extension(pos positionInfo, url string) error

func (*FhirVisitorCollectReferences) GetReferences

func (v *FhirVisitorCollectReferences) GetReferences() []string

func (*FhirVisitorCollectReferences) Instant

func (v *FhirVisitorCollectReferences) Instant(pos positionInfo, value string) error

func (*FhirVisitorCollectReferences) Null

func (v *FhirVisitorCollectReferences) Null(pos positionInfo) error

func (*FhirVisitorCollectReferences) Number

func (v *FhirVisitorCollectReferences) Number(pos positionInfo, value string) error

func (*FhirVisitorCollectReferences) Reference

func (v *FhirVisitorCollectReferences) Reference(pos positionInfo, value string) error

func (*FhirVisitorCollectReferences) String

func (v *FhirVisitorCollectReferences) String(pos positionInfo, value string) error

type Resource

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

func NewResourceFromBSON

func NewResourceFromBSON(bsonDoc []bson.E) (resource *Resource, err error)

func NewResourceFromJsonBytes

func NewResourceFromJsonBytes(jsonBytes []byte) (resource *Resource, err error)

func (*Resource) AsShallowBundle

func (r *Resource) AsShallowBundle(failedRequestsDir string) (bundle *ShallowBundle, err error)

func (*Resource) GetBSON

func (r *Resource) GetBSON() (interface{}, error)

func (*Resource) Id

func (r *Resource) Id() string

func (*Resource) JsonBytes

func (r *Resource) JsonBytes() []byte

func (*Resource) LastUpdated

func (r *Resource) LastUpdated() string

func (*Resource) LastUpdatedTime

func (r *Resource) LastUpdatedTime() time.Time

func (*Resource) MarshalBSON

func (r *Resource) MarshalBSON() ([]byte, error)

Implements bson2.Marshaler

func (*Resource) MarshalJSON

func (r *Resource) MarshalJSON() ([]byte, error)

func (*Resource) ResourceType

func (r *Resource) ResourceType() string

func (*Resource) SearchIncludes

func (r *Resource) SearchIncludes() []*Resource

func (*Resource) SearchIncludesOfType

func (r *Resource) SearchIncludesOfType(resourceType string) []*Resource

func (*Resource) SetId

func (r *Resource) SetId(id string)

func (*Resource) SetLastUpdated

func (r *Resource) SetLastUpdated(lastUpdated string)

func (*Resource) SetLastUpdatedTime

func (r *Resource) SetLastUpdatedTime(t time.Time)

func (*Resource) SetTransformReferencesMap

func (r *Resource) SetTransformReferencesMap(transformReferencesMap map[string]string)

func (*Resource) SetVersionId

func (r *Resource) SetVersionId(versionId int)

func (*Resource) SetWhatToEncrypt

func (r *Resource) SetWhatToEncrypt(whatToEncrypt WhatToEncrypt)

func (*Resource) Unmarshal

func (r *Resource) Unmarshal(v interface{}) error

func (*Resource) UnmarshalJSON

func (r *Resource) UnmarshalJSON(data []byte) (err error)

func (*Resource) VersionId

func (r *Resource) VersionId() string

type ShallowBundle

type ShallowBundle struct {
	ResourceType string                        `json:"resourceType,omitempty"`
	Meta         *models.Meta                  `json:"meta,omitempty"`
	Type         string                        `json:"type,omitempty"`
	Id           string                        `json:"id,omitempty"`
	Total        *uint32                       `json:"total,omitempty"`
	Entry        []ShallowBundleEntryComponent `json:"entry,omitempty"`
	Link         []models.BundleLinkComponent  `json:"link,omitempty"`
}

func (*ShallowBundle) GetAllReferences

func (b *ShallowBundle) GetAllReferences() (references []string, err error)

func (*ShallowBundle) MarshalJSON

func (r *ShallowBundle) MarshalJSON() ([]byte, error)

func (*ShallowBundle) SetTransformReferencesMap

func (b *ShallowBundle) SetTransformReferencesMap(transformReferencesMap map[string]string)

func (*ShallowBundle) ToResource

func (r *ShallowBundle) ToResource() (*Resource, error)

type ShallowBundleEntryComponent

type ShallowBundleEntryComponent struct {
	Resource *Resource                            `json:"resource,omitempty"`
	FullUrl  string                               `json:"fullUrl,omitempty"`
	Search   *models.BundleEntrySearchComponent   `json:"search,omitempty"`
	Request  *models.BundleEntryRequestComponent  `json:"request,omitempty"`
	Response *models.BundleEntryResponseComponent `json:"response,omitempty"`
}

type WhatToEncrypt

type WhatToEncrypt struct {
	PatientDetails bool
}

Jump to

Keyboard shortcuts

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