/** * This module contains the Resource core FHIR model along with other resource related functions. * * @privateRemarks * The FHIR ResourceType assertion contains a reference to the Resource data model that results * in a circular reference when it was in the type-guards.ts module. Therefore, the FHIR ResourceType * assertion function was moved into this module. * * The setFhirResourceJson/setFhirResourceListJson contains a reference to the Resource data model * that results in a circular reference when it was in the json-helpers.ts module. Therefore, these * functions were moved into this module. * * @module */ import { Base } from './Base'; import { IResource } from './library-interfaces'; import { Meta } from '../data-types/complex/Meta'; import { CodeType } from '../data-types/primitive/CodeType'; import { IdType } from '../data-types/primitive/IdType'; import { fhirCode, fhirId, fhirUri } from '../data-types/primitive/primitive-types'; import { UriType } from '../data-types/primitive/UriType'; import * as JSON from '../utility/json-helpers'; /** * Abstract Resource Class * * @remarks * This is the base resource type for everything. * * This specification defines a series of different types of resource that can be used to exchange and/or store data * to solve a wide range of healthcare-related problems, both clinical and administrative. In addition, this * specification defines several different ways of exchanging the resources. * * A resource is an entity that: * - has a known identity (a URL) by which it can be addressed * - identifies itself as one of the types of resource defined in this specification * - contains a set of structured data items as described by the definition of the resource type * - has an identified version that changes if the contents of the resource change. * * **FHIR Specification** * - **Short:** Base Resource. * - **Definition:** This is the base resource type for everything. * - **FHIR Version:** 4.0.1; Normative since 4.0.0 * * @privateRemarks * Loosely based on HAPI FHIR org.hl7.fhir-core.r4.model.Resource * * @category Base Models * @see [FHIR Resource](http://hl7.org/fhir/StructureDefinition/Resource) */ export declare abstract class Resource extends Base implements IResource { protected constructor(); /** * Parse the provided json to instantiate the data model. * * @remarks * * @param _sourceJson - JSON representing FHIR resource * @param _optSourceField - Optional data source field (e.g. `.`) * @returns Data model or undefined * * @abstract */ static parse(_sourceJson: JSON.Object, _optSourceField?: string): IResource | undefined; /** * @returns the FHIR resource type as defined by the FHIR specification */ resourceType(): string; /** * Resource.id Element * * @remarks * **FHIR Specification** * - **Short:** Logical id of this artifact * - **Definition:** The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes. * - **Comment:** The only time that a resource does not have an id is when it is being submitted to the server using a create operation. * - **FHIR Type:** `id` * - **Cardinality:** 0..1 * - **isModifier:** false * - **isSummary:** true */ private id?; /** * Resource.meta Element * * @remarks * **FHIR Specification** * - **Short:** Metadata about the resource * - **Definition:** The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content might not always be associated with version changes to the resource. * - **FHIR Type:** `Meta` * - **Cardinality:** 0..1 * - **isModifier:** false * - **isSummary:** true */ private meta?; /** * Resource.implicitRules Element * * @remarks * **FHIR Specification** * - **Short:** A set of rules under which this content was created * - **Definition:** A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc. * - **Comment:** Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of it's narrative along with other profiles, value sets, etc. * - **FHIR Type:** `uri` * - **Cardinality:** 0..1 * - **isModifier:** true * - **isModifierReason:** This element is labeled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation * - **isSummary:** true */ private implicitRules?; /** * Resource.language Element * * @remarks * **FHIR Specification** * - **Short:** Language of the resource content * - **Definition:** The base language in which the resource is written. * - **Comment:** Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource. Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). * - **FHIR Type:** `code` * - **Cardinality:** 0..1 * - **isModifier:** false * - **isSummary:** false */ private language?; /** * @returns the `id` property value as a PrimitiveType */ getIdElement(): IdType; /** * Assigns the provided PrimitiveType value to the `id` property. * * @param element - the `id` value * @returns this */ setIdElement(element: IdType | undefined): this; /** * @returns `true` if the `id` property exists and has a value; `false` otherwise */ hasIdElement(): boolean; /** * @returns the `id` property value as a primitive value */ getId(): fhirId | undefined; /** * Assigns the provided primitive value to the `id` property. * * @param value - the `id` value * @returns this * @throws {@link PrimitiveTypeError} for invalid primitive types */ setId(value: fhirId | undefined): this; /** * @returns `true` if the `id` property exists and has a value; `false` otherwise */ hasId(): boolean; /** * @returns the `meta` property value as a Meta */ getMeta(): Meta; /** * Assigns the provided value to the `meta` property. * * @param value - the `meta` value * @returns this */ setMeta(value: Meta | undefined): this; /** * @returns `true` if the `meta` property exists and has a value; `false` otherwise */ hasMeta(): boolean; /** * @returns the `implicitRules` property value as a PrimitiveType */ getImplicitRulesElement(): UriType; /** * Assigns the provided PrimitiveType value to the `implicitRules` property. * * @param element - the `implicitRules` value * @returns this */ setImplicitRulesElement(element: UriType | undefined): this; /** * @returns `true` if the `implicitRules` property exists and has a value; `false` otherwise */ hasImplicitRulesElement(): boolean; /** * @returns the `implicitRules` property value as a primitive value */ getImplicitRules(): fhirUri | undefined; /** * Assigns the provided primitive value to the `implicitRules` property. * * @param value - the `implicitRules` value * @returns this * @throws {@link PrimitiveTypeError} for invalid primitive types */ setImplicitRules(value: fhirUri | undefined): this; /** * @returns `true` if the `system` property exists and has a value; `false` otherwise */ hasImplicitRules(): boolean; /** * @returns the `language` property value as a PrimitiveType */ getLanguageElement(): CodeType; /** * Assigns the provided PrimitiveType value to the `language` property. * * @param element - the `language` value * @returns this */ setLanguageElement(element: CodeType | undefined): this; /** * @returns `true` if the `language` property exists and has a value; `false` otherwise */ hasLanguageElement(): boolean; /** * @returns the `language` property value as a primitive value */ getLanguage(): fhirCode | undefined; /** * Assigns the provided primitive value to the `language` property. * * @param value - the `language` value * @returns this * @throws {@link PrimitiveTypeError} for invalid primitive types */ setLanguage(value: fhirCode | undefined): this; /** * @returns `true` if the `language` property exists and has a value; `false` otherwise */ hasLanguage(): boolean; /** * @returns the FHIR type defined in the FHIR standard */ abstract fhirType(): string; /** * @returns `true` if the instance is empty; `false` otherwise */ isEmpty(): boolean; /** * Creates a copy of the current instance. * * @returns the a new instance copied from the current instance */ abstract copy(): Resource; /** * Copies the current instance's elements into the provided object. * * @param dest - the copied instance * @protected */ protected copyValues(dest: Resource): void; /** * @returns `true` if the instance is a FHIR resource; `false` otherwise */ isResource(): boolean; /** * @returns the JSON value */ toJSON(): JSON.Value | undefined; } /** * FHIR ResourceType assertion for any FHIR resource class * * @param classInstance - class instance to evaluate * @param errorMessage - optional error message to override the default * @throws {@link InvalidTypeError} when ResourceType assertion is false * * @category Type Guards/Assertions */ export declare function assertFhirResourceType(classInstance: unknown, errorMessage?: string): asserts classInstance is IResource; /** * Transforms the provided FHIR Resource to its JSON representation and adds it to the provided JSON.Object. * Does nothing if the Resource's value is undefined. * * @param resource - FHIR Resource to transform * @param propName - the property name for the provided FHIR complex DataType * @param jsonObj - JSON.Object to which to add the transformed FHIR complex DataType * @throws [AssertionError](https://nodejs.org/docs/latest-v22.x/api/assert.html#class-assertassertionerror) for invalid parameters * * @category Utilities: JSON */ export declare function setFhirResourceJson(resource: IResource, propName: string, jsonObj: JSON.Object): void; /** * Transforms the provided array of FHIR Resource to their JSON representation and adds it to the provided * JSON.Object. Does nothing if the FHIR Resource's value is undefined. * * @param resources - array of FHIR Resources to transform (can be empty array) * @param propName - the property name for the provided FHIR complex DataTypes * @param jsonObj - JSON.Object to which to add the transformed FHIR complex DataTypes * @throws [AssertionError](https://nodejs.org/docs/latest-v22.x/api/assert.html#class-assertassertionerror) for invalid parameters * * @category Utilities: JSON */ export declare function setFhirResourceListJson(resources: IResource[], propName: string, jsonObj: JSON.Object): void; //# sourceMappingURL=Resource.d.ts.map