--- type: "resource" title: "Library" resource: "Library" --- # Library ## Introduction ## Scope and Usage The Library resource is a general purpose knowledge artifact that can fulfill a variety of use cases, including managing collections of artifacts, providing a FHIR wrapper for non-FHIR knowledge artifacts, and describing logic and interaction capabilities of knowledge modules. For example, a Library may be used to wrap a non-FHIR representation, such as a shareable library of clinical logic, written in [Clinical Quality Language (CQL)](http://cql.hl7.org). In addition, a Library may be used to refer to artifacts defined using FHIR resources such as the description of a protocol represented by a PlanDefinition resource. As a CanonicalResource and MetadataResource, a Library has all the typical metadata such as url, identifier, version, and title. In addition, the resource has elements for tracking dependencies, as well as for representing the parameters and data requirements for any expression functionality provided by the library. For non-FHIR assets, the actual content of the library is represented using the Attachment data type, and may either be referenced with a URL, or the content may be embedded as a base-64 encoded string. Either way, the `contentType` element of the attachment is used to indicate the representation of the library content. Note that because the library content may be embedded as well as be retrievable from an external repository via the attachment URL, the possibility exists for the embedded content to be different from the content on the repository. With proper versioning and governance, this should never occur, but to minimize the potential impact of this possibility, implementers SHALL give precedence to the embedded content of a library when it is present. A common use case for the Library resource is to establish the release dependencies of a collection of artifacts. A library with a type of `asset-collection` can be used to define the collection of artifacts, as well as the required dependencies, especially when the artifacts in the collection have version-independent canonical references, as is often the case with CodeSystem and ValueSet references. This usage is known as an _artifact manifest_, and is described more fully in the [Artifact Manifest](http://hl7.org/fhir/uv/crmi/version-manifest.html) topic of the [Canonical Resource Management Infrastructure](http://hl7.org/fhir/uv/crmi/index.html) implementation guide. ## Boundaries and Relationships The Library resource is definitional in nature, meaning it is intended to represent shareable knowledge independent of any particular patient. This is in contrast to the [DocumentReference](documentreference) resource, which captures non-FHIR content related to a specific patient, multimedia content, or other raw binary content. ## Background and Context Provides additional detail on exactly how the resource is to be used ## StructureDefinition ### Elements (Simplified) - **[Library](/library-definitions#Library)** [0..*]: - Represents a library of quality improvement components - **[Library.url](/library-definitions#Library.url)** [0..1]: [uri](/uri) Canonical identifier for this library, represented as a URI (globally unique) - **[Library.identifier](/library-definitions#Library.identifier)** [0..*]: [Identifier](/Identifier) Additional identifier for the library - **[Library.version](/library-definitions#Library.version)** [0..1]: [string](/string) Business version of the library - **[Library.versionAlgorithm[x]](/library-definitions#Library.versionAlgorithm%5Bx%5D)** [0..1]: [string](/string), [Coding](/Coding) extensible:[version-algorithm](/valueset-version-algorithm) How to compare versions - **[Library.name](/library-definitions#Library.name)** [0..1]: [string](/string) Name for this library (computer friendly) - **[Library.title](/library-definitions#Library.title)** [0..1]: [string](/string) Name for this library (human friendly) - **[Library.subtitle](/library-definitions#Library.subtitle)** [0..1]: [string](/string) Subordinate title of the library - **[Library.status](/library-definitions#Library.status)** [1..1]: [code](/code) required:[publication-status](/valueset-publication-status) draft | active | retired | unknown - **[Library.experimental](/library-definitions#Library.experimental)** [0..1]: [boolean](/boolean) For testing only - never for real usage - **[Library.type](/library-definitions#Library.type)** [1..1]: [CodeableConcept](/CodeableConcept) extensible:[library-type](/valueset-library-type) logic-library | model-definition | asset-collection | module-definition | etc. - **[Library.subject[x]](/library-definitions#Library.subject%5Bx%5D)** [0..1]: [CodeableConcept](/CodeableConcept), Reference([Group](/Group)) extensible:[participant-resource-types](/valueset-participant-resource-types) Type of individual the library content is focused on - **[Library.date](/library-definitions#Library.date)** [0..1]: [dateTime](/dateTime) Date last changed - **[Library.publisher](/library-definitions#Library.publisher)** [0..1]: [string](/string) Name of the publisher/steward (organization or individual) - **[Library.contact](/library-definitions#Library.contact)** [0..*]: [ContactDetail](/ContactDetail) Contact details for the publisher - **[Library.description](/library-definitions#Library.description)** [0..1]: [markdown](/markdown) Natural language description of the library - **[Library.useContext](/library-definitions#Library.useContext)** [0..*]: [UsageContext](/UsageContext) The context that the content is intended to support - **[Library.jurisdiction](/library-definitions#Library.jurisdiction)** [0..*]: [CodeableConcept](/CodeableConcept) extensible:[jurisdiction](/valueset-jurisdiction) Jurisdiction of the authority that maintains the library (if applicable) - **[Library.purpose](/library-definitions#Library.purpose)** [0..1]: [markdown](/markdown) Why this library is defined - **[Library.usage](/library-definitions#Library.usage)** [0..1]: [markdown](/markdown) Describes the clinical usage of the library - **[Library.copyright](/library-definitions#Library.copyright)** [0..1]: [markdown](/markdown) Notice about intellectual property ownership, can include restrictions on use - **[Library.copyrightLabel](/library-definitions#Library.copyrightLabel)** [0..1]: [string](/string) Copyright holder and year(s) - **[Library.approvalDate](/library-definitions#Library.approvalDate)** [0..1]: [date](/date) When the library was approved by publisher - **[Library.lastReviewDate](/library-definitions#Library.lastReviewDate)** [0..1]: [date](/date) When the library was last reviewed by the publisher - **[Library.effectivePeriod](/library-definitions#Library.effectivePeriod)** [0..1]: [Period](/Period) When the library is expected to be used - **[Library.topic](/library-definitions#Library.topic)** [0..*]: [CodeableConcept](/CodeableConcept) example:[definition-topic](/valueset-definition-topic) E.g. Education, Treatment, Assessment, etc - **[Library.author](/library-definitions#Library.author)** [0..*]: [ContactDetail](/ContactDetail) Who authored the content - **[Library.editor](/library-definitions#Library.editor)** [0..*]: [ContactDetail](/ContactDetail) Who edited the content - **[Library.reviewer](/library-definitions#Library.reviewer)** [0..*]: [ContactDetail](/ContactDetail) Who reviewed the content - **[Library.endorser](/library-definitions#Library.endorser)** [0..*]: [ContactDetail](/ContactDetail) Who endorsed the content - **[Library.relatedArtifact](/library-definitions#Library.relatedArtifact)** [0..*]: [RelatedArtifact](/RelatedArtifact) Additional documentation, citations, etc - **[Library.parameter](/library-definitions#Library.parameter)** [0..*]: [ParameterDefinition](/ParameterDefinition) Parameters defined by the library - **[Library.dataRequirement](/library-definitions#Library.dataRequirement)** [0..*]: [DataRequirement](/DataRequirement) What data is referenced by this library - **[Library.content](/library-definitions#Library.content)** [0..*]: [Attachment](/Attachment) Contents of the library, either embedded or referenced ## Mappings - [Library Mappings](/library-mappings) — 54 mapping entries ## Operations - [data-requirements](/library-operation-data-requirements) — Data Requirements — The data-requirements operation aggregates and returns the parameters and data requirements for a resource and all its dependencies as a single module definition [Full Operations](/library-operations) ## Resource Packs ### list-Library-packs.xml ```xml ``` ## Search Parameters - [composed-of](/library-search#composed-of) — **reference** — What resource is being referenced — `Library.relatedArtifact.where(type='composed-of').resource` - [content-type](/library-search#content-type) — **token** — The type of content in the library (e.g. text/cql) — `Library.content.contentType` - [context](/library-search#context) — **token** — A use context assigned to the library — `(Library.useContext.value.ofType(CodeableConcept))` - [context-quantity](/library-search#context-quantity) — **quantity** — A quantity- or range-valued use context assigned to the library — `(Library.useContext.value.ofType(Quantity)) | (Library.useContext.value.ofType(Range))` - [context-type](/library-search#context-type) — **token** — A type of use context assigned to the library — `Library.useContext.code` - [context-type-quantity](/library-search#context-type-quantity) — **composite** — A use context type and quantity- or range-based value assigned to the library — `Library.useContext` - [context-type-value](/library-search#context-type-value) — **composite** — A use context type and value assigned to the library — `Library.useContext` - [date](/library-search#date) — **date** — The library publication date — `Library.date` - [depends-on](/library-search#depends-on) — **reference** — What resource is being referenced — `Library.relatedArtifact.where(type='depends-on').resource` - [derived-from](/library-search#derived-from) — **reference** — What resource is being referenced — `Library.relatedArtifact.where(type='derived-from').resource` - [description](/library-search#description) — **string** — The description of the library — `Library.description` - [effective](/library-search#effective) — **date** — The time during which the library is intended to be in use — `Library.effectivePeriod` - [identifier](/library-search#identifier) — **token** — External identifier for the library — `Library.identifier` - [jurisdiction](/library-search#jurisdiction) — **token** — Jurisdiction of the authority that maintains the the library — `Library.jurisdiction` - [name](/library-search#name) — **string** — Computationally friendly name of the library — `Library.name` - [predecessor](/library-search#predecessor) — **reference** — What resource is being referenced — `Library.relatedArtifact.where(type='predecessor').resource` - [publisher](/library-search#publisher) — **string** — Name of the publisher of the library — `Library.publisher` - [status](/library-search#status) — **token** — The current status of the library — `Library.status` - [subject-code](/library-search#subject-code) — **token** — The subject of the Library when expressed as a code — `Library.subject as CodeableConcept` - [subject-reference](/library-search#subject-reference) — **reference** — The subject of the Library when expressed as a reference — `Library.subject as Reference` - [subject-canonical](/library-search#subject-canonical) — **reference** — The subject of the Library when expressed as a canonical — `Library.subject as canonical` - [successor](/library-search#successor) — **reference** — What resource is being referenced — `Library.relatedArtifact.where(type='successor').resource` - [title](/library-search#title) — **string** — The human-friendly name of the library — `Library.title` - [topic](/library-search#topic) — **token** — Topics associated with the module — `Library.topic` - [type](/library-search#type) — **token** — The type of the library (e.g. logic-library, model-definition, asset-collection, module-definition) — `Library.type` - [url](/library-search#url) — **uri** — The uri that identifies the library — `Library.url` - [version](/library-search#version) — **token** — The business version of the library — `Library.version` - [experimental](/library-search#experimental) — **token** — Whether the Library is experimental — `Library.experimental` [Full Search Parameters](/library-search) ## Examples - [composition-example](/library-example-composition-example) — library-composition-example — Zika Virus Management Library - [example](/library-example-example) — library-example — Chlamydia Screening Common Library - [ExampleEventDefinitionLogic](/library-example-ExampleEventDefinitionLogic) — library-ExampleEventDefinitionLogic — Example EventDefinition Logic - [hiv-indicators](/library-example-hiv-indicators) — library-hiv-indicators — HIV Indicators Reporting Example - [library-cms146-example](/library-example-library-cms146-example) — library-cms146-example — CMS146 Measure Logic - [library-example](/library-example-library-example) — library-example - [library-examples-header](/library-example-library-examples-header) — library-examples-header - [library-exclusive-breastfeeding-cds-logic](/library-example-library-exclusive-breastfeeding-cds-logic) — library-exclusive-breastfeeding-cds-logic — Exclusive Breastfeeding Intervention Logic - [library-exclusive-breastfeeding-cqm-logic](/library-example-library-exclusive-breastfeeding-cqm-logic) — library-exclusive-breastfeeding-cqm-logic — Exclusive Breastfeeding Measurement Logic - [library-fhir-helpers](/library-example-library-fhir-helpers) — library-fhir-helpers — FHIR Helpers - [library-fhir-helpers-predecessor](/library-example-library-fhir-helpers-predecessor) — library-predecessor-example — Predecessor library example - [library-fhir-model-definition](/library-example-library-fhir-model-definition) — library-fhir-model-definition — FHIR Model Definition - [library-quick-model-definition](/library-example-library-quick-model-definition) — library-quick-model-definition — QUICK Model Definition - [omtk-logic](/library-example-omtk-logic) — library-omtk-logic — OMTK Logic - [omtk-modelinfo](/library-example-omtk-modelinfo) — library-omtk-modelinfo — OMTK Model - [opioidcds-common](/library-example-opioidcds-common) — library-opioidcds-common — Opioid CDS Common Library - [opioidcds-recommendation-04](/library-example-opioidcds-recommendation-04) — library-opioidcds-recommendation-04 — Opioid CDS Recommendation 4 Logic - [opioidcds-recommendation-05](/library-example-opioidcds-recommendation-05) — library-opioidcds-recommendation-05 — Opioid CDS Recommendation 5 Logic - [opioidcds-recommendation-07](/library-example-opioidcds-recommendation-07) — library-opioidcds-recommendation-07 — Opioid CDS Recommendation 7 Logic - [opioidcds-recommendation-08](/library-example-opioidcds-recommendation-08) — library-opioidcds-recommendation-08 — Opioid CDS Recommendation 8 Logic - [opioidcds-recommendation-10](/library-example-opioidcds-recommendation-10) — library-opioidcds-recommendation-10 — Opioid CDS Recommendation 10 Logic - [opioidcds-recommendation-11](/library-example-opioidcds-recommendation-11) — library-opioidcds-recommendation-11 — Opioid CDS Recommendation 11 Logic - [suiciderisk-orderset-logic](/library-example-suiciderisk-orderset-logic) — library-mmi-suiciderisk-orderset-logic — Suicide Risk Order Set Logic - [zika-virus-intervention-logic](/library-example-zika-virus-intervention-logic) — library-zika-virus-intervention-logic — Zika Virus Management Intervention Logic [Full Examples](/library-examples) ## Mapping Exceptions ### library-definition-mapping-exceptions.xml ### Divergent Elements - **Definition.version** → **Library.version** - commentsUnmatched | reason=Unknown | pattern=There may be different librarys that have the same url but different versions. The version can be appended to the url in a reference to allow a reference to a particular business version of the library with the format. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). | resource=There may be different library instances that have the same identifier but different versions. The version can be appended to the url in a reference to allow a reference to a particular business version of the library with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). - **Definition.copyright** → **Library.copyright** - requirementsUnmatched | reason=Unknown | pattern=Consumers of the library must be able to determine any legal restrictions on the use of the artifact and/or its content. | resource=Consumers must be able to determine any legal restrictions on the use of the library and/or its content. ### Unmapped Elements - **Definition** — Unknown - **Definition.subject** — Unknown - **Definition.versionAlgorithm** — Unknown ### library-fivews-mapping-exceptions.xml ### Unmapped Elements - **FiveWs.author** — Unknown - **FiveWs.actor** — Unknown - **FiveWs.cause** — Unknown - **FiveWs.where** — Unknown - **FiveWs.context** — Unknown - **FiveWs.init** — Unknown - **FiveWs.source** — Unknown - **FiveWs.who** — Unknown - **FiveWs.grade** — Unknown - **FiveWs.planned** — Unknown - **FiveWs.done** — Unknown - **FiveWs.subject** — Unknown