Documentation ¶
Overview ¶
Package resource contains utilities for working with abstract FHIR Resource objects.
Index ¶
- Variables
- func GetIdentifierList(res fhir.Resource) ([]*dtpb.Identifier, error)
- func GroupResources(resources []fhir.Resource) map[Type][]fhir.Resource
- func ID(resource fhir.Resource) string
- func IsType(name string) bool
- func New(name Type, opts ...Option) fhir.Resource
- func NewFromString(name string, opts ...Option) (fhir.Resource, error)
- func NewOf[T fhir.Resource](opts ...Option) fhir.Resource
- func ProfileStrings(resource fhir.Resource) []string
- func Profiles(resource fhir.Resource) []*dtpb.Canonical
- func RemoveDuplicates(resources []fhir.Resource) []fhir.Resource
- func URI(resource fhir.Resource) *dtpb.Uri
- func URIString(resource fhir.Resource) string
- func Update(res fhir.Resource, opts ...Option) fhir.Resource
- func VersionETag(r fhir.Resource) string
- func VersionID(resource fhir.Resource) string
- func VersionedURI(resource fhir.Resource) *dtpb.Uri
- func VersionedURIString(resource fhir.Resource) (string, bool)
- type CanonicalIdentity
- type HasGetIdentifierList
- type HasGetIdentifierSingle
- type Identity
- func (i *Identity) Equal(other *Identity) bool
- func (i *Identity) ID() string
- func (i *Identity) PreferRelativeVersionedURI() *dtpb.Uri
- func (i *Identity) PreferRelativeVersionedURIString() string
- func (i *Identity) RelativeURI() *dtpb.Uri
- func (i *Identity) RelativeURIString() string
- func (i *Identity) RelativeVersionedURI() (*dtpb.Uri, bool)
- func (i *Identity) RelativeVersionedURIString() (string, bool)
- func (i *Identity) String() string
- func (i *Identity) Type() Type
- func (i *Identity) Unversioned() *Identity
- func (i *Identity) VersionID() (string, bool)
- func (i *Identity) WithNewVersion(versionID string) *Identity
- type Option
- type Type
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ErrBadType = errors.New("bad resource type")
ErrBadType is an error raised when a bad type is provided.
var (
ErrGetIdentifierList = errors.New("GetIdentifierList()")
)
var ( // ErrMissingCanonicalURL is thrown when creating a canonical identity without having a URL. ErrMissingCanonicalURL = errors.New("missing canonical url") )
Functions ¶
func GetIdentifierList ¶
func GetIdentifierList(res fhir.Resource) ([]*dtpb.Identifier, error)
GetIdentifierList takes a Resource and returns a list of Identifiers. It uses duck typing to determine whether the resource has a GetIdentifier() method, and if so, whether it returns a list or a single Identifier. It returns ErrGetIdentifierList if the resource does not implement GetIdentifier(). The list may be nil or empty if no identifiers are present. See interfaces: fhir.HasGetIdentifierList, fhir.HasGetIdentifierSingle
Example ¶
package main import ( "fmt" dtpb "github.com/google/fhir/go/proto/google/fhir/proto/r4/core/datatypes_go_proto" "github.com/google/fhir/go/proto/google/fhir/proto/r4/core/resources/patient_go_proto" "github.com/verily-src/fhirpath-go/internal/fhir" "github.com/verily-src/fhirpath-go/internal/resource" ) func main() { patient := &patient_go_proto.Patient{ Id: fhir.ID("12345"), Identifier: []*dtpb.Identifier{ &dtpb.Identifier{ System: &dtpb.Uri{Value: "http://fake.com"}, Value: &dtpb.String{Value: "9efbf82d-7a58-4d14-bec1-63f8fda148a8"}, }, }, } ids, err := resource.GetIdentifierList(patient) if err != nil { panic(err) } else if ids == nil || len(ids) == 0 { panic("no identifiers") } else { fmt.Printf("Identifier value: %#v", ids[0].GetValue().Value) } }
Output: Identifier value: "9efbf82d-7a58-4d14-bec1-63f8fda148a8"
func GroupResources ¶
GroupResources organizes all resources by their underlying resource Type, and returns a map of the Type to the list of resources of that given type.
Nil resources are skipped. Resources with existing IDs are skipped
func ID ¶
ID gets the ID of the specified resource as a string. If `nil` is provided, this returns an empty string.
func IsType ¶
IsType queries whether the given string names a Resource type.
Note: This is case-sensitive, and expects CamelCase, jus as the FHIR spec uses.
func New ¶
New constructs a new resource from the input type, using the specified options to construct it.
This function assumes that Type is a validly-constructed type object. Failure to pass a valid type will result in a panic.
func NewFromString ¶
NewFromString attempts to construct a resource of the specified string name type, using the specified options to construct it. This function returns an error if 'name' does not name a valid type.
func NewOf ¶
NewOf constructs a new resource of the named T resource type, using the specified options to construct it.
func ProfileStrings ¶ added in v1.1.0
ProfileStrings is a helper for getting the fhir profiles of a resource in string form.
If the resource is nil, this will return nil.
func Profiles ¶ added in v1.1.0
Profiles is a helper for getting the fhir profiles of a resource in canonical form.
If the resource is nil, this will return nil.
func RemoveDuplicates ¶
RemoveDuplicates finds all duplicates of resources -- determined by the same <resource>/<id>/<version-id> -- and removes them, returning an updated list of resources.
Nil resources are skipped.
func URI ¶
URI is a helper for getting the URI of a resource as a URI object. The URI is returned in the format Type/ID, e.g. Patient/123.
If the resource is nil, this will return a nil URI.
func URIString ¶
URIString is a helper for getting the URI of a resource in string form. The URI is returned in the format Type/ID, e.g. Patient/123.
If the resource is nil, this will return an empty string.
func VersionETag ¶
VersionETag pulls the "version" from the resource if it's an existing resource that was queried from a FHIR store; the version returned matches the ETag header returned by GET fhir-prefix/{resourceType}/{id} for this resource. This is used for optimistic locking on resources per https://hl7.org/fhir/http.html#concurrency
func VersionID ¶
VersionID gets the version-ID of the specified resource as a string. If `nil` is provided, this returns an empty string.
This function on its own just simplifies the need of calling `GetMeta().GetVersionId().GetValue()` all the time.
func VersionedURI ¶
VersionedURI is a helper for getting the URI of a resource as a URI object. The URI is returned in the format Type/ID/_history/VERSION.
If the resource is nil, this will return a nil URI.
Types ¶
type CanonicalIdentity ¶
type CanonicalIdentity struct { Version string Url string Fragment string // only used if a fragment of resource is targetted }
CanonicalIdentity is a canonical representation of a FHIR Resource.
This object stores the individual pieces of id used in creating a canonical reference.
func NewCanonicalIdentity ¶
func NewCanonicalIdentity(url, version, fragment string) (*CanonicalIdentity, error)
NewCanonicalIdentity creates a canonicalIdentity based on the given url, version and fragment
func (*CanonicalIdentity) String ¶
func (c *CanonicalIdentity) String() string
String returns a string representation of this CanonicalIdentity.
func (*CanonicalIdentity) Type ¶
func (c *CanonicalIdentity) Type() (Type, bool)
Type attempts to identify the resource type associated with the identity.
type HasGetIdentifierList ¶
type HasGetIdentifierList interface { GetIdentifier() []*dtpb.Identifier // embed Resource since anything with an Identifier is also a Resource fhir.Resource }
HasGetIdentifierList is a custom interface for duck typing resources that have a GetIdentifier method that returns a slice of Identifiers.
type HasGetIdentifierSingle ¶
type HasGetIdentifierSingle interface { GetIdentifier() *dtpb.Identifier // embed Resource since anything with an Identifier is also a Resource fhir.Resource }
HasGetIdentifierSingle is a custom interface for duck typing resources that have a GetIdentifier method that returns a single Identifier.
type Identity ¶
type Identity struct {
// contains filtered or unexported fields
}
Identity is a representation of a FHIR Resource's temporal instance.
This is similar to a FHIR Reference, except without any explicit sementics of a referential relationship. Rather, this object simply acts as a carrier for the data that may be used for general identity purposes, such as logging.
func IdentityOf ¶
IdentityOf attempts to form a resource Identity object to the named resource. If the specified resource is either nil, or does not contain an ID value, no resource identity will be formed and this function will return nil.
func NewIdentity ¶
NewIdentity attempts to create a new Identity object from a runtime-provided string resourceType name, and its id/versionID. If the provided resourceType does not name a valid resource-type (case-sensitive), this function will return an ErrBadType error.
func NewIdentityFromHistoryURL ¶
NewIdentityFromHistoryURL attempts to create a new Identity object from a runtime-provided history URL.
Input: [FHIR Proxy/Store URL]/fhir/[resourceType]/[resourceId]/_history/[versionId]
func NewIdentityFromURL ¶ added in v1.1.0
NewIdentityFromURL attempts to create a new Identity object from a runtime-provided URL.
Input: [FHIR Service Base URL]/[resourceType]/[resourceId] or [resourceType]/[resourceId]
func (*Identity) Equal ¶
Equal implements equality comparison between identity instances.
The Equal() method, when used by the "cmp" package MUST support nils: see "...even if x or y is nil" from second bullet in https://pkg.go.dev/github.com/google/go-cmp/cmp#Equal.
func (*Identity) PreferRelativeVersionedURI ¶
PreferRelativeVersionURI returns the relative version URI if available, otherwise the relative URI only.
func (*Identity) PreferRelativeVersionedURIString ¶
PreferRelativeVersionedURIString returns the relative version URI string if available, otherwise the relative URI only.
func (*Identity) RelativeURI ¶
RelativeURI returns a relative URI of this resource.
func (*Identity) RelativeURIString ¶
RelativeURIString returns a string representation of the RelativeURI for convenience.
func (*Identity) RelativeVersionedURI ¶
RelativeVersionedURI returns a relative URI of this resource including the version identifier, if it is known.
func (*Identity) RelativeVersionedURIString ¶
RelativeVersionedURIString returns a string representation of the RelativeVersionedURI for convenience.
func (*Identity) String ¶
String returns a string representation of this Identity.
The exact representation should not be relied on for any practical purpose; the only thing that is guaranteed is that for the unique triple of data containing (type, id, version), the String will contain these details -- but the exact form is unspecified.
func (*Identity) Type ¶
Type returns the resource Identity's underlying type. This is guaranteed to always be a valid resource type.
func (*Identity) Unversioned ¶
Unversioned returns a new Identity that does not have a VersionID.
func (*Identity) VersionID ¶
VersionID returns the explicit version of the resource, if it is known.
func (*Identity) WithNewVersion ¶
WithNewVersion returns a new Identity that has the specified VersionID.
type Option ¶
type Option = resourceopt.Option
Option is an option that may be supplied to updates or creations of Resource types.
func WithID ¶
WithID returns a resource Option for setting the Resourec ID with the id of the provided string.
func WithImplicitRules ¶
WithImplicitRules returns a resource Option for setting the Resource implicit rules with the provided string.
func WithLanguage ¶
WithLanguage returns a resource Option for setting the Resource language to the code of the provided string.
type Type ¶
type Type string
Type is a FHIR Resource type object. This is similar to a reflect.Type that encodes its name identifier
Type objects should never be constructed manually; rather, use the `CheckType` or `TypeOf` functions to get a valid type object. Invalid instances of Type may lead to unexpected implicit `panic` behavior, as any code consuming this is allowed to assume that `Type` always names a valid instance.
const ( // Account is the TypeSpecifier constant for the "Account" resource. Account Type = "Account" // ActivityDefinition is the TypeSpecifier constant for the "ActivityDefinition" resource. ActivityDefinition Type = "ActivityDefinition" // AdverseEvent is the TypeSpecifier constant for the "AdverseEvent" resource. AdverseEvent Type = "AdverseEvent" // AllergyIntolerance is the TypeSpecifier constant for the "AllergyIntolerance" resource. AllergyIntolerance Type = "AllergyIntolerance" // Appointment is the TypeSpecifier constant for the "Appointment" resource. Appointment Type = "Appointment" // AppointmentResponse is the TypeSpecifier constant for the "AppointmentResponse" resource. AppointmentResponse Type = "AppointmentResponse" // AuditEvent is the TypeSpecifier constant for the "AuditEvent" resource. AuditEvent Type = "AuditEvent" // Basic is the TypeSpecifier constant for the "Basic" resource. Basic Type = "Basic" // Binary is the TypeSpecifier constant for the "Binary" resource. Binary Type = "Binary" // BiologicallyDerivedProduct is the TypeSpecifier constant for the "BiologicallyDerivedProduct" resource. BiologicallyDerivedProduct Type = "BiologicallyDerivedProduct" // BodyStructure is the TypeSpecifier constant for the "BodyStructure" resource. BodyStructure Type = "BodyStructure" // Bundle is the TypeSpecifier constant for the "Bundle" resource. Bundle Type = "Bundle" // CapabilityStatement is the TypeSpecifier constant for the "CapabilityStatement" resource. CapabilityStatement Type = "CapabilityStatement" // CarePlan is the TypeSpecifier constant for the "CarePlan" resource. CarePlan Type = "CarePlan" // CareTeam is the TypeSpecifier constant for the "CareTeam" resource. CareTeam Type = "CareTeam" // CatalogEntry is the TypeSpecifier constant for the "CatalogEntry" resource. CatalogEntry Type = "CatalogEntry" // ChargeItem is the TypeSpecifier constant for the "ChargeItem" resource. ChargeItem Type = "ChargeItem" // ChargeItemDefinition is the TypeSpecifier constant for the "ChargeItemDefinition" resource. ChargeItemDefinition Type = "ChargeItemDefinition" // Claim is the TypeSpecifier constant for the "Claim" resource. Claim Type = "Claim" // ClaimResponse is the TypeSpecifier constant for the "ClaimResponse" resource. ClaimResponse Type = "ClaimResponse" // ClinicalImpression is the TypeSpecifier constant for the "ClinicalImpression" resource. ClinicalImpression Type = "ClinicalImpression" // CodeSystem is the TypeSpecifier constant for the "CodeSystem" resource. CodeSystem Type = "CodeSystem" // Communication is the TypeSpecifier constant for the "Communication" resource. Communication Type = "Communication" // CommunicationRequest is the TypeSpecifier constant for the "CommunicationRequest" resource. CommunicationRequest Type = "CommunicationRequest" // CompartmentDefinition is the TypeSpecifier constant for the "CompartmentDefinition" resource. CompartmentDefinition Type = "CompartmentDefinition" // Composition is the TypeSpecifier constant for the "Composition" resource. Composition Type = "Composition" // ConceptMap is the TypeSpecifier constant for the "ConceptMap" resource. ConceptMap Type = "ConceptMap" // Condition is the TypeSpecifier constant for the "Condition" resource. Condition Type = "Condition" // Consent is the TypeSpecifier constant for the "Consent" resource. Consent Type = "Consent" // Contract is the TypeSpecifier constant for the "Contract" resource. Contract Type = "Contract" // Coverage is the TypeSpecifier constant for the "Coverage" resource. Coverage Type = "Coverage" // CoverageEligibilityRequest is the TypeSpecifier constant for the "CoverageEligibilityRequest" resource. CoverageEligibilityRequest Type = "CoverageEligibilityRequest" // CoverageEligibilityResponse is the TypeSpecifier constant for the "CoverageEligibilityResponse" resource. CoverageEligibilityResponse Type = "CoverageEligibilityResponse" // DetectedIssue is the TypeSpecifier constant for the "DetectedIssue" resource. DetectedIssue Type = "DetectedIssue" // Device is the TypeSpecifier constant for the "Device" resource. Device Type = "Device" // DeviceDefinition is the TypeSpecifier constant for the "DeviceDefinition" resource. DeviceDefinition Type = "DeviceDefinition" // DeviceMetric is the TypeSpecifier constant for the "DeviceMetric" resource. DeviceMetric Type = "DeviceMetric" // DeviceRequest is the TypeSpecifier constant for the "DeviceRequest" resource. DeviceRequest Type = "DeviceRequest" // DeviceUseStatement is the TypeSpecifier constant for the "DeviceUseStatement" resource. DeviceUseStatement Type = "DeviceUseStatement" // DiagnosticReport is the TypeSpecifier constant for the "DiagnosticReport" resource. DiagnosticReport Type = "DiagnosticReport" // DocumentManifest is the TypeSpecifier constant for the "DocumentManifest" resource. DocumentManifest Type = "DocumentManifest" // DocumentReference is the TypeSpecifier constant for the "DocumentReference" resource. DocumentReference Type = "DocumentReference" // EffectEvidenceSynthesis is the TypeSpecifier constant for the "EffectEvidenceSynthesis" resource. EffectEvidenceSynthesis Type = "EffectEvidenceSynthesis" // Encounter is the TypeSpecifier constant for the "Encounter" resource. Encounter Type = "Encounter" // Endpoint is the TypeSpecifier constant for the "Endpoint" resource. Endpoint Type = "Endpoint" // EnrollmentRequest is the TypeSpecifier constant for the "EnrollmentRequest" resource. EnrollmentRequest Type = "EnrollmentRequest" // EnrollmentResponse is the TypeSpecifier constant for the "EnrollmentResponse" resource. EnrollmentResponse Type = "EnrollmentResponse" // EpisodeOfCare is the TypeSpecifier constant for the "EpisodeOfCare" resource. EpisodeOfCare Type = "EpisodeOfCare" // EventDefinition is the TypeSpecifier constant for the "EventDefinition" resource. EventDefinition Type = "EventDefinition" // Evidence is the TypeSpecifier constant for the "Evidence" resource. Evidence Type = "Evidence" // EvidenceVariable is the TypeSpecifier constant for the "EvidenceVariable" resource. EvidenceVariable Type = "EvidenceVariable" // ExampleScenario is the TypeSpecifier constant for the "ExampleScenario" resource. ExampleScenario Type = "ExampleScenario" // ExplanationOfBenefit is the TypeSpecifier constant for the "ExplanationOfBenefit" resource. ExplanationOfBenefit Type = "ExplanationOfBenefit" // FamilyMemberHistory is the TypeSpecifier constant for the "FamilyMemberHistory" resource. FamilyMemberHistory Type = "FamilyMemberHistory" // Flag is the TypeSpecifier constant for the "Flag" resource. Flag Type = "Flag" // Goal is the TypeSpecifier constant for the "Goal" resource. Goal Type = "Goal" // GraphDefinition is the TypeSpecifier constant for the "GraphDefinition" resource. GraphDefinition Type = "GraphDefinition" // Group is the TypeSpecifier constant for the "Group" resource. Group Type = "Group" // GuidanceResponse is the TypeSpecifier constant for the "GuidanceResponse" resource. GuidanceResponse Type = "GuidanceResponse" // HealthcareService is the TypeSpecifier constant for the "HealthcareService" resource. HealthcareService Type = "HealthcareService" // ImagingStudy is the TypeSpecifier constant for the "ImagingStudy" resource. ImagingStudy Type = "ImagingStudy" // Immunization is the TypeSpecifier constant for the "Immunization" resource. Immunization Type = "Immunization" // ImmunizationEvaluation is the TypeSpecifier constant for the "ImmunizationEvaluation" resource. ImmunizationEvaluation Type = "ImmunizationEvaluation" // ImmunizationRecommendation is the TypeSpecifier constant for the "ImmunizationRecommendation" resource. ImmunizationRecommendation Type = "ImmunizationRecommendation" // ImplementationGuide is the TypeSpecifier constant for the "ImplementationGuide" resource. ImplementationGuide Type = "ImplementationGuide" // InsurancePlan is the TypeSpecifier constant for the "InsurancePlan" resource. InsurancePlan Type = "InsurancePlan" // Invoice is the TypeSpecifier constant for the "Invoice" resource. Invoice Type = "Invoice" // Library is the TypeSpecifier constant for the "Library" resource. Library Type = "Library" // Linkage is the TypeSpecifier constant for the "Linkage" resource. Linkage Type = "Linkage" // List is the TypeSpecifier constant for the "List" resource. List Type = "List" // Location is the TypeSpecifier constant for the "Location" resource. Location Type = "Location" // Measure is the TypeSpecifier constant for the "Measure" resource. Measure Type = "Measure" // MeasureReport is the TypeSpecifier constant for the "MeasureReport" resource. MeasureReport Type = "MeasureReport" // Media is the TypeSpecifier constant for the "Media" resource. Media Type = "Media" // Medication is the TypeSpecifier constant for the "Medication" resource. Medication Type = "Medication" // MedicationAdministration is the TypeSpecifier constant for the "MedicationAdministration" resource. MedicationAdministration Type = "MedicationAdministration" // MedicationDispense is the TypeSpecifier constant for the "MedicationDispense" resource. MedicationDispense Type = "MedicationDispense" // MedicationKnowledge is the TypeSpecifier constant for the "MedicationKnowledge" resource. MedicationKnowledge Type = "MedicationKnowledge" // MedicationRequest is the TypeSpecifier constant for the "MedicationRequest" resource. MedicationRequest Type = "MedicationRequest" // MedicationStatement is the TypeSpecifier constant for the "MedicationStatement" resource. MedicationStatement Type = "MedicationStatement" // MedicinalProduct is the TypeSpecifier constant for the "MedicinalProduct" resource. MedicinalProduct Type = "MedicinalProduct" // MedicinalProductAuthorization is the TypeSpecifier constant for the "MedicinalProductAuthorization" resource. MedicinalProductAuthorization Type = "MedicinalProductAuthorization" // MedicinalProductContraindication is the TypeSpecifier constant for the "MedicinalProductContraindication" resource. MedicinalProductContraindication Type = "MedicinalProductContraindication" // MedicinalProductIndication is the TypeSpecifier constant for the "MedicinalProductIndication" resource. MedicinalProductIndication Type = "MedicinalProductIndication" // MedicinalProductIngredient is the TypeSpecifier constant for the "MedicinalProductIngredient" resource. MedicinalProductIngredient Type = "MedicinalProductIngredient" // MedicinalProductInteraction is the TypeSpecifier constant for the "MedicinalProductInteraction" resource. MedicinalProductInteraction Type = "MedicinalProductInteraction" // MedicinalProductManufactured is the TypeSpecifier constant for the "MedicinalProductManufactured" resource. MedicinalProductManufactured Type = "MedicinalProductManufactured" // MedicinalProductPackaged is the TypeSpecifier constant for the "MedicinalProductPackaged" resource. MedicinalProductPackaged Type = "MedicinalProductPackaged" // MedicinalProductPharmaceutical is the TypeSpecifier constant for the "MedicinalProductPharmaceutical" resource. MedicinalProductPharmaceutical Type = "MedicinalProductPharmaceutical" // MedicinalProductUndesirableEffect is the TypeSpecifier constant for the "MedicinalProductUndesirableEffect" resource. MedicinalProductUndesirableEffect Type = "MedicinalProductUndesirableEffect" // MessageDefinition is the TypeSpecifier constant for the "MessageDefinition" resource. MessageDefinition Type = "MessageDefinition" // MessageHeader is the TypeSpecifier constant for the "MessageHeader" resource. MessageHeader Type = "MessageHeader" // MolecularSequence is the TypeSpecifier constant for the "MolecularSequence" resource. MolecularSequence Type = "MolecularSequence" // NamingSystem is the TypeSpecifier constant for the "NamingSystem" resource. NamingSystem Type = "NamingSystem" // NutritionOrder is the TypeSpecifier constant for the "NutritionOrder" resource. NutritionOrder Type = "NutritionOrder" // Observation is the TypeSpecifier constant for the "Observation" resource. Observation Type = "Observation" // ObservationDefinition is the TypeSpecifier constant for the "ObservationDefinition" resource. ObservationDefinition Type = "ObservationDefinition" // OperationDefinition is the TypeSpecifier constant for the "OperationDefinition" resource. OperationDefinition Type = "OperationDefinition" // OperationOutcome is the TypeSpecifier constant for the "OperationOutcome" resource. OperationOutcome Type = "OperationOutcome" // Organization is the TypeSpecifier constant for the "Organization" resource. Organization Type = "Organization" // OrganizationAffiliation is the TypeSpecifier constant for the "OrganizationAffiliation" resource. OrganizationAffiliation Type = "OrganizationAffiliation" // Parameters is the TypeSpecifier constant for the "Parameters" resource. Parameters Type = "Parameters" // Patient is the TypeSpecifier constant for the "Patient" resource. Patient Type = "Patient" // PaymentNotice is the TypeSpecifier constant for the "PaymentNotice" resource. PaymentNotice Type = "PaymentNotice" // PaymentReconciliation is the TypeSpecifier constant for the "PaymentReconciliation" resource. PaymentReconciliation Type = "PaymentReconciliation" // Person is the TypeSpecifier constant for the "Person" resource. Person Type = "Person" // PlanDefinition is the TypeSpecifier constant for the "PlanDefinition" resource. PlanDefinition Type = "PlanDefinition" // Practitioner is the TypeSpecifier constant for the "Practitioner" resource. Practitioner Type = "Practitioner" // PractitionerRole is the TypeSpecifier constant for the "PractitionerRole" resource. PractitionerRole Type = "PractitionerRole" // Procedure is the TypeSpecifier constant for the "Procedure" resource. Procedure Type = "Procedure" // Provenance is the TypeSpecifier constant for the "Provenance" resource. Provenance Type = "Provenance" // Questionnaire is the TypeSpecifier constant for the "Questionnaire" resource. Questionnaire Type = "Questionnaire" // QuestionnaireResponse is the TypeSpecifier constant for the "QuestionnaireResponse" resource. QuestionnaireResponse Type = "QuestionnaireResponse" // RelatedPerson is the TypeSpecifier constant for the "RelatedPerson" resource. RelatedPerson Type = "RelatedPerson" // RequestGroup is the TypeSpecifier constant for the "RequestGroup" resource. RequestGroup Type = "RequestGroup" // ResearchDefinition is the TypeSpecifier constant for the "ResearchDefinition" resource. ResearchDefinition Type = "ResearchDefinition" // ResearchElementDefinition is the TypeSpecifier constant for the "ResearchElementDefinition" resource. ResearchElementDefinition Type = "ResearchElementDefinition" // ResearchStudy is the TypeSpecifier constant for the "ResearchStudy" resource. ResearchStudy Type = "ResearchStudy" // ResearchSubject is the TypeSpecifier constant for the "ResearchSubject" resource. ResearchSubject Type = "ResearchSubject" // RiskAssessment is the TypeSpecifier constant for the "RiskAssessment" resource. RiskAssessment Type = "RiskAssessment" // RiskEvidenceSynthesis is the TypeSpecifier constant for the "RiskEvidenceSynthesis" resource. RiskEvidenceSynthesis Type = "RiskEvidenceSynthesis" // Schedule is the TypeSpecifier constant for the "Schedule" resource. Schedule Type = "Schedule" // SearchParameter is the TypeSpecifier constant for the "SearchParameter" resource. SearchParameter Type = "SearchParameter" // ServiceRequest is the TypeSpecifier constant for the "ServiceRequest" resource. ServiceRequest Type = "ServiceRequest" // Slot is the TypeSpecifier constant for the "Slot" resource. Slot Type = "Slot" // Specimen is the TypeSpecifier constant for the "Specimen" resource. Specimen Type = "Specimen" // SpecimenDefinition is the TypeSpecifier constant for the "SpecimenDefinition" resource. SpecimenDefinition Type = "SpecimenDefinition" // StructureDefinition is the TypeSpecifier constant for the "StructureDefinition" resource. StructureDefinition Type = "StructureDefinition" // StructureMap is the TypeSpecifier constant for the "StructureMap" resource. StructureMap Type = "StructureMap" // Subscription is the TypeSpecifier constant for the "Subscription" resource. Subscription Type = "Subscription" // Substance is the TypeSpecifier constant for the "Substance" resource. Substance Type = "Substance" // SubstanceNucleicAcid is the TypeSpecifier constant for the "SubstanceNucleicAcid" resource. SubstanceNucleicAcid Type = "SubstanceNucleicAcid" // SubstancePolymer is the TypeSpecifier constant for the "SubstancePolymer" resource. SubstancePolymer Type = "SubstancePolymer" // SubstanceProtein is the TypeSpecifier constant for the "SubstanceProtein" resource. SubstanceProtein Type = "SubstanceProtein" // SubstanceReferenceInformation is the TypeSpecifier constant for the "SubstanceReferenceInformation" resource. SubstanceReferenceInformation Type = "SubstanceReferenceInformation" // SubstanceSourceMaterial is the TypeSpecifier constant for the "SubstanceSourceMaterial" resource. SubstanceSourceMaterial Type = "SubstanceSourceMaterial" // SubstanceSpecification is the TypeSpecifier constant for the "SubstanceSpecification" resource. SubstanceSpecification Type = "SubstanceSpecification" // SupplyDelivery is the TypeSpecifier constant for the "SupplyDelivery" resource. SupplyDelivery Type = "SupplyDelivery" // SupplyRequest is the TypeSpecifier constant for the "SupplyRequest" resource. SupplyRequest Type = "SupplyRequest" // Task is the TypeSpecifier constant for the "Task" resource. Task Type = "Task" // TerminologyCapabilities is the TypeSpecifier constant for the "TerminologyCapabilities" resource. TerminologyCapabilities Type = "TerminologyCapabilities" // TestReport is the TypeSpecifier constant for the "TestReport" resource. TestReport Type = "TestReport" // TestScript is the TypeSpecifier constant for the "TestScript" resource. TestScript Type = "TestScript" // ValueSet is the TypeSpecifier constant for the "ValueSet" resource. ValueSet Type = "ValueSet" // VerificationResult is the TypeSpecifier constant for the "VerificationResult" resource. VerificationResult Type = "VerificationResult" // VisionPrescription is the TypeSpecifier constant for the "VisionPrescription" resource. VisionPrescription Type = "VisionPrescription" )
func NewType ¶
NewType checks whether the string type name is a valid resource.Type instance. If it is, an instance of the type is returned. If the provided type is not a valid type, an ErrBadType is returned, and the type result is garbage.
Note: This is case-sensitive, and expects CamelCase, just as the FHIR spec uses.
func TypeOf ¶
TypeOf gets the underlying type of the named resource.
This function panics if resource is nil. Note that this is only an issue if the interface `fhir.Resource` is nil, *not* if the underlying resource is a pointer that is nil. E.g. the following holds true:
assert.True(resource.TypeOf((*ppb.Patient)(nil)) == resource.Patient)
func (Type) New ¶
New returns an instance of the FHIR Resource which this type names, using the provided options to toggle.
This function will panic if this does not name a valid Resource Type.
func (Type) StructureDefinitionURI ¶
StructureDefinitionURI returns an absolute URI to the structure-definition URL.