Documentation ¶
Overview ¶
Package fhircore contains utility functions to deal with core FHIR types.
Index ¶
- Constants
- Variables
- func AddNewExtensionsOnly(source []*pb.Extension, target []*pb.Extension) []*pb.Extension
- func AddOrUpdateExtension(extensions []*pb.Extension, newExt *pb.Extension) ([]*pb.Extension, error)
- func AddOrUpdateIdentifier(identifiers []*pb.Identifier, identifier *pb.Identifier) []*pb.Identifier
- func AllergyIntoleranceRef(id string) *pb.Reference
- func Boolean(b bool) *pb.Boolean
- func BooleanExtension(url string, value bool) *pb.Extension
- func Code(c string) *pb.Code
- func Coding(code string, system string, display string) *pb.Coding
- func ConditionRef(id string) *pb.Reference
- func Date(t time.Time, p pb.Date_Precision) *pb.Date
- func DateTime(t time.Time, z string, p pb.DateTime_Precision) *pb.DateTime
- func DateTimeExtension(url string, t time.Time, precision pb.DateTime_Precision) *pb.Extension
- func DateTimeToTime(t *pb.DateTime) time.Time
- func Decimal(s string) (*pb.Decimal, error)
- func DeleteAllExtensions(extensions []*pb.Extension, url string) []*pb.Extension
- func DiagnosticReportRef(id string) *pb.Reference
- func DocumentReferenceRef(id string) *pb.Reference
- func EncounterRef(id string) *pb.Reference
- func FindAllExtensions(extensions []*pb.Extension, url string) []*pb.Extension
- func FindFirstExtension(extensions []*pb.Extension, url string) *pb.Extension
- func FindIdentifiers(identifiers []*pb.Identifier, code string) []*pb.Identifier
- func FindLastExtension(extensions []*pb.Extension, url string) *pb.Extension
- func GetBooleanExtension(extensions []*pb.Extension, name string) (bool, error)
- func GetDateTimeExtension(extensions []*pb.Extension, name string) (*pb.DateTime, error)
- func GetIntegerExtension(extensions []*pb.Extension, name string) (int32, error)
- func GetMRN(ids []*pb.Identifier) []string
- func GetNHS(ids []*pb.Identifier) []string
- func GetStringExtension(extensions []*pb.Extension, name string) (string, error)
- func GetValue(id *pb.Identifier) string
- func Id(i string) *pb.Id
- func Identifier(value string, code string) *pb.Identifier
- func IdentifierMRN(value string) *pb.Identifier
- func IdentifierNHS(value string) *pb.Identifier
- func IdentifierSecondaryMRN(value string, typeCode string, authority string, facility string) *pb.Identifier
- func IdentifierVisitNumber(value string) *pb.Identifier
- func Instant(t time.Time, z string) *pb.Instant
- func Integer(i int32) *pb.Integer
- func IntegerExtension(url string, value int32) *pb.Extension
- func LocationRef(id string) *pb.Reference
- func ObservationRef(id string) *pb.Reference
- func OrganizationRef(id string) *pb.Reference
- func PatientRef(id string) *pb.Reference
- func PersonRef(id string) *pb.Reference
- func PractitionerRef(id string) *pb.Reference
- func ProcedureRef(id string) *pb.Reference
- func ServiceRequestRef(id string) *pb.Reference
- func String(s string) *pb.String
- func StringExtension(url string, value string) *pb.Extension
- func Time(t time.Time, p pb.Time_Precision) *pb.Time
- func UnixMicro(t time.Time) int64
- func Uri(u string) *pb.Uri
Constants ¶
const ( MRNIdentifierCode = "MR" MRNIdentifierDisplay = "Medical Record Number" NHSIdentifierCode = "NH" NHSIdentifierDisplay = "UK National Health System identifier" VisitNumberIdentifierCode = "VN" VisitNumberIdentifierDisplay = "Visit number" SecondaryMRNIdentifierCode = "MR_S" SecondaryMRIdentifierDisplay = "Medical record number (secondary)" IdentifierAssigningAuthorityExt = "IdentifierAssigningAuthority" IdentifierAssigningFacilityExt = "IdentifierAssigningFacility" IdentifierTypeCodeExt = "IdentifierTypeCode" // IdentifierTypeCodeSystem represents values in http://hl7.org/fhir/valueset-identifier-type.html IdentifierTypeCodeSystem = "http://hl7.org/fhir/ValueSet/identifier-type" )
Variables ¶
Functions ¶
func AddNewExtensionsOnly ¶
AddNewExtensionsOnly adds the "target" extensions to "source", as long as the extensions aren't present in "source".
func AddOrUpdateExtension ¶
func AddOrUpdateExtension(extensions []*pb.Extension, newExt *pb.Extension) ([]*pb.Extension, error)
AddOrUpdateExtension either updates the provided extension, if there is already one with the same URL, or inserts it at the end. It returns the updated list of extensions. If there are multiple extensions with the same URL, it returns an error.
func AddOrUpdateIdentifier ¶
func AddOrUpdateIdentifier(identifiers []*pb.Identifier, identifier *pb.Identifier) []*pb.Identifier
AddOrUpdateIdentifier will either update the provided identifier, if there already is one with the same Code, or will insert a new one. AddOrUpdateIdentifier returns the updated list of identifiers. The entire identifier is updated. If the matched identifier has multiple Coding items, all of those will be lost if the provided identifier has a single Coding (which is usually the case).
func AllergyIntoleranceRef ¶
func BooleanExtension ¶
BooleanExtension creates an extension with a boolean value.
func ConditionRef ¶
func DateTime ¶
DateTime creates a FHIR DateTime from the provided time, using z as the timezone. If precision p is set to seconds, the time is truncated.
func DateTimeExtension ¶
DateTimeExtension creates a DateTime extension.
func DateTimeToTime ¶
DateTimeToTime returns time.Time from the FHIR proto, assuming that the time unit is microseconds, which is a standard for streams-internal interfaces.
func DeleteAllExtensions ¶
DeleteAllExtensions deletes all extensions with the matching URL from a list of Extension and returns the pruned list.
func DiagnosticReportRef ¶
func DocumentReferenceRef ¶
func EncounterRef ¶
func FindAllExtensions ¶
FindAllExtensions returns all the extensions with the provided URL.
func FindFirstExtension ¶
FindFirstExtension returns the first Extension in extensions with the provided URL, or nil if not found.
func FindIdentifiers ¶
func FindIdentifiers(identifiers []*pb.Identifier, code string) []*pb.Identifier
FindIdentifiers returns the list of identifiers that match the given code.
func FindLastExtension ¶
FindLastExtension returns the last Extension in extensions with the provided URL, or nil if not found.
func GetBooleanExtension ¶
GetBooleanExtension gets the boolean contained in the extension with the provided name. If the extension is not found, it returns ErrMissingExtension.
func GetDateTimeExtension ¶
GetDateTimeExtension gets the DateTime value from the extension with the provided name. If the extension is not found, it returns ErrMissingExtension. If the extension is found but it's not of DateTime type, it returns an error. Use DateTimeToTime on the returned value to convert it to time.Time.
func GetIntegerExtension ¶
GetIntegerExtension gets the integer contained in the extension with the provided name. If the extension is not found, it returns ErrMissingExtension.
func GetMRN ¶
func GetMRN(ids []*pb.Identifier) []string
GetMRN returns the MRNs in the provided list of Identifiers.
func GetNHS ¶
func GetNHS(ids []*pb.Identifier) []string
GetNHS returns the NHS numbers in the provided list of Identifiers. Generally there will be just one.
func GetStringExtension ¶
GetStringExtension gets the string contained in the extension with the provided name. If the extension is not found, it returns ErrMissingExtension.
func GetValue ¶
func GetValue(id *pb.Identifier) string
func Identifier ¶
func Identifier(value string, code string) *pb.Identifier
Identifier creates an identifier proto with the given parameters.
func IdentifierMRN ¶
func IdentifierMRN(value string) *pb.Identifier
func IdentifierNHS ¶
func IdentifierNHS(value string) *pb.Identifier
func IdentifierSecondaryMRN ¶
func IdentifierSecondaryMRN(value string, typeCode string, authority string, facility string) *pb.Identifier
IdentifierSecondaryMRN creates a secondary MRN identifier.
We use all of authority, facility and typeCode, even if they are empty, because MRNs need to match all of those in order to be considered equal.
func IdentifierVisitNumber ¶
func IdentifierVisitNumber(value string) *pb.Identifier
func IntegerExtension ¶
IntegerExtension creates an extension with an integer value.
func LocationRef ¶
func ObservationRef ¶
func OrganizationRef ¶
func PatientRef ¶
func PractitionerRef ¶
func ProcedureRef ¶
func ServiceRequestRef ¶
func StringExtension ¶
StringExtension creates an extension with a string value.
Types ¶
This section is empty.