DomainResource

open class DomainResource: Resource

A resource with narrative, extensions, and contained resources.

A resource that includes narrative, extensions, and contained resources.

  • A resource with narrative, extensions, and contained resources.

    A resource that includes narrative, extensions, and contained resources.

    Declaration

    Swift

    override open class var resourceType: String
  • Contained, inline Resources.

    Declaration

    Swift

    public var contained: [Resource]?
  • Additional Content defined by implementations.

    Declaration

    Swift

    public var extension_fhir: [Extension]?
  • Extensions that cannot be ignored.

    Declaration

    Swift

    public var modifierExtension: [Extension]?
  • Text summary of the resource, for human interpretation.

    Declaration

    Swift

    public var text: Narrative?
  • Text summary of the resource, for human interpretation.

    Declaration

    Swift

    override open func populate(from json: FHIRJSON, context instCtx: inout FHIRInstantiationContext)
  • Undocumented

    Declaration

    Swift

    open class DomainResource: Resource
  • Contains the given resource and returns the Reference element on success.

    Use the return value to assign it to the appropriate property of the containing resource:

    let order = Order(json: ["id": ...])
    let patient = Patient(json: ["id": "subject", ...])
    order.subject = try! order.containResource(patient)
    

    If a resource with the same id is already contained, it will be replaced.

    Declaration

    Swift

    open func contain(resource: Resource, withDisplay display: String? = nil) throws -> Reference

    Parameters

    resource

    The instance to contain in the receiver

    display

    The string that will become the reference’s display

    Return Value

    A Reference instance pointing to the contained resource (as “#id”)

  • Adds a relative or absolute reference to the receiver, depending on whether the resources live on the same server or not.

    You need to make sure both the receiver and the given resource have their _server set, otherwise the method cannot determine when a relative URL could be used.

    You usually use the method like this:

    let server = FHIROpenServer(...)
    
    let lab = Organization()
    lab.id = "ACME"
    ...
    lab._server = server
    
    let task = Task()
    task.created = DateTime.now()
    ...
    task._server = server
    
    task.owner = try task.referenceResource(lab)
    

    Declaration

    Swift

    open func reference(resource: Resource, withDisplay display: FHIRString? = nil) throws -> Reference

    Parameters

    resource

    The resource that should be referenced

    display

    The string that will become the reference’s display

    Return Value

    A Reference, ready for use

  • Returns an array of Extension elements for the given extension URL, if any.

    Declaration

    Swift

    public final func extensions(forURI uri: String) -> [Extension]?

    Parameters

    forURI

    The URI defining the extension on the receiver

  • Returns an array of Extension elements for the given modifier extension URL, if any.

    Declaration

    Swift

    public final func modifierExtensions(forURI uri: String) -> [Extension]?

    Parameters

    forURI

    The URI defining the modifier extension on the receiver