2020年2月29日 星期六

HL7 FHIR 資源詳解篇 - Terminology - ValueSet

Resource ValueSet - Content

與CodeSystem一樣都是ANSI認可者。兩者真的是相互為用。
所有的CodeSystem都一定會有一個ValueSet。但是一個ValueSet,可能包含數個CodeSystem來源。
在使用上,若是編碼相關的元素,原則上都會綁定一個ValueSet。就看這個ValueSet的Content Logical Definition所描述包含哪些CodeSystem。
但就定義的角度,一定會先有CodeSystem,然後對應一組ValueSet。在特定情境用途上,新增一組ValueSet,取自不同CodeSystem部分子集合。

(Structure省略)
ValueSet繼承了CanonicalResource(Abstract),在copyright(含)之前的元素都是來自CanonicalResource。

ValueSet.compose

compose是用來說明此ValueSet包含了哪些CodeSystem,個別的CodeSystem,包含哪些Concept(也就是編碼),以及哪些Concept才需要被放進來。
或者是指向這個CodeSystem的ValueSet。

ValueSet.expansion

這個是用來表示此ValueSet對外服務的內容,若是程式而言,就是列舉型態。

範例

<?xml version="1.0" encoding="UTF-8"?>

<ValueSet xmlns="http://hl7.org/fhir">
  <id value="yesnodontknow"/> 
  <text> 
    <status value="generated"/> 
    <div xmlns="http://www.w3.org/1999/xhtml">
      <h3> Value Set Contents</h3> 
      <p> This value set contains 3 concepts</p> 
      <table class="codes">
        <tr> 
          <td style="white-space:nowrap">
            <b> Code</b> 
          </td> 
          <td> 
            <b> System</b> 
          </td> 
          <td> 
            <b> Display</b> 
          </td> 
          <td> 
            <b> Definition</b> 
          </td> 
        </tr> 
        <tr> 
          <td style="white-space:nowrap">
            <a name="http---terminology.hl7.org-CodeSystem-v2-0136-Y"> </a> 
            <a href="v2/0136/index.html#v2-0136-Y">Y</a> 
          </td> 
          <td> http://terminology.hl7.org/CodeSystem/v2-0136</td> 
          <td> Yes</td> 
          <td/>  
        </tr> 
        <tr> 
          <td style="white-space:nowrap">
            <a name="http---terminology.hl7.org-CodeSystem-v2-0136-N"> </a> 
            <a href="v2/0136/index.html#v2-0136-N">N</a> 
          </td> 
          <td> http://terminology.hl7.org/CodeSystem/v2-0136</td> 
          <td> No</td> 
          <td/>  
        </tr> 
        <tr> 
          <td style="white-space:nowrap">
            <a name="http---terminology.hl7.org-CodeSystem-data-absent-reason-asked-unknown"> </a> 
            <a href="codesystem-data-absent-reason.html#data-absent-reason-asked-unknown">asked-unknown</a> 
          </td> 
          <td> http://terminology.hl7.org/CodeSystem/data-absent-reason</td> 
          <td> Don't know</td> 
          <td> The source was asked but does not know the value.</td> 
        </tr> 
      </table> 
    </div> 
  </text> 
  <url value="http://hl7.org/fhir/ValueSet/yesnodontknow"/> 
  <version value="4.2.0"/> 
  <name value="Yes/No/Don't Know"/> 
  <status value="draft"/> 
  <description value="For Capturing simple yes-no-don't know answers"/> 
  <compose> 
    <include> 
      <valueSet value="http://terminology.hl7.org/ValueSet/v2-0136"/> 
    </include> 
    <include> 
      <system value="http://terminology.hl7.org/CodeSystem/data-absent-reason"/> 
      <concept> 
        <code value="asked-unknown"/> 
        <display value="Don't know"/> 
      </concept> 
    </include> 
  </compose> 
  <expansion> 
    <identifier value="urn:uuid:bf99fe50-2c2b-41ad-bd63-bee6919810b4"/> 
    <timestamp value="2015-07-14T10:00:00Z"/> 
    <contains> 
      <system value="http://terminology.hl7.org/CodeSystem/v2-0136"/> 
      <code value="Y"/> 
      <display value="Yes"/> 
    </contains> 
    <contains> 
      <system value="http://terminology.hl7.org/CodeSystem/v2-0136"/> 
      <code value="N"/> 
      <display value="No"/> 
    </contains> 
    <contains> 
      <system value="http://terminology.hl7.org/CodeSystem/data-absent-reason"/> 
      <code value="asked-unknown"/> 
      <display value="Don't know"/> 
    </contains> 
  </expansion> 
</ValueSet>
這個ValueSet包含了兩個CodeSystem。
  • 第一個CodeSystem是來自V2 Table,URL是http://terminology.hl7.org/ValueSet/v2-0136 。無其他說明,所以是使用了所有的concept。
  • 第二個CodeSystem是data-absent-reason。但是,利用<concept>來說明,從這個CodeSystem取出哪些Concept來使用。
然後,真正使用上宣告使用時,如<expansion>所示。


2020年2月27日 星期四

HL7 FHIR 資源詳解篇 - Terminology - CodeSystem

Resource CodeSystem - Content

CodeSystem已經是Normative等級之文件,並取得ANSI認可。

FHIR的術語規範深受HL7 v3所影響,透過CodeSystem可取得相關資訊。但在FHIR中,Value Set也是個非常重要觀念且直接使用。CodeSystem的主要是用在宣告。
  • 辨識URL與版次。Identifying URL and version
  • 描述、版權、發布日期等其他中繼資料。Description, Copyright, publication date, and other metadata
  • 用於編碼系統本身的一些關鍵屬性。Some key properties of the code system itself - e.g. whether it exhibits concept permanence, whether it defines a compositional grammar, and whether the codes that it defines are case sensitive
  • 用來過濾欄位時,可知道ValueSet.Compose元素可下什麼條件。What filters can be used in value sets that use the code system in a ValueSet.compose element
  • 可知道編碼系統所定義的觀念屬性。What concept properties are defined by the code system
這個CodeSystem不是取代現有編碼系統的管理機制。但是,對於自訂編碼的部分,個人覺得就非常重要且好用。

  • CodeSystem是被用於ValueSet此Resource。
  • Coding這個資料型態,可參照CodeSystem的正規網址(canonical URL)
  • CodeSystem是HL7 CTS 2 
  • CodeSystem只紀錄了編碼系統的結構與相容性等資訊,真正具備有操作性的是使用TerminologyCapabilities。
編碼系統在HL7的所有標準體系中都非常重要,可惜國內一直「強烈」忽視這一塊。想深入了解,可參考這份文件: Using Codes in Resources
使用CodeSystem時,有三個元素容易混淆。
  • CodeSystem.id:這是FHIR Server給定的唯一編碼值。當然可以給流水號,或者是有意義的編碼。但他可視範圍是在此FHIR Server。
  • CodeSystem.url:這是此Cody System的正規網址,你可以視為一個命名空間。這是整個標準應用環境下是唯一值。也就是說,台灣TW可以自己搞一套。
  • CodeSystem.identifier:這個是把Code System拿去註冊取得OID編碼。他的唯一性,就看父層是掛誰了。
NameFlagsCard.TypeDescription & Constraints
.. CodeSystemNCanonicalResourceDeclares the existence of and describes a code system or code system supplement
+ Warning: Name should be usable as an identifier for the module by machine processing applications such as code generation
+ Rule: Within a code system definition, all the codes SHALL be unique
Elements defined in Ancestors: idmetaimplicitRuleslanguagetextcontainedextensionmodifierExtensionurl,
identifierversionnametitlestatusexperimentaldatepublishercontactdescriptionuseContextjurisdictionpurposecopyright
... urlΣ0..1uriCanonical identifier for this code system, represented as a URI (globally unique) (Coding.system)
... identifierΣ0..*IdentifierAdditional identifier for the code system (business identifier)
... versionΣ0..1stringBusiness version of the code system (Coding.version)
... titleΣ0..1stringName for this code system (human friendly)
... status?!Σ1..1codedraft | active | retired | unknown
PublicationStatus (Required)
... experimentalΣ0..1booleanFor testing purposes, not real usage
... dateΣ0..1dateTimeDate last changed
... publisherΣ0..1stringName of the publisher (organization or individual)
... contactΣ0..*ContactDetailContact details for the publisher
... description0..1markdownNatural language description of the code system
... useContextΣTU0..*UsageContextThe context that the content is intended to support
... jurisdictionΣ0..*CodeableConceptIntended jurisdiction for code system (if applicable)
Jurisdiction (Extensible)
... purpose0..1markdownWhy this code system is defined
... copyright0..1markdownUse and/or publishing restrictions
... caseSensitiveΣ0..1booleanIf code comparison is case sensitive
... valueSetΣ0..1canonical(ValueSet)Canonical reference to the value set with entire code system
... hierarchyMeaningΣ0..1codegrouped-by | is-a | part-of | classified-with
CodeSystemHierarchyMeaning (Required)
... compositionalΣ0..1booleanIf code system defines a compositional grammar
... versionNeededΣ0..1booleanIf definitions are not stable
... contentΣ1..1codenot-present | example | fragment | complete | supplement
CodeSystemContentMode (Required)
... supplementsΣ0..1canonical(CodeSystem)Canonical URL of Code System this adds designations and properties to
... countΣ0..1unsignedIntTotal concepts in the code system
... filterΣ0..*BackboneElementFilter that can be used in a value set
.... codeΣ1..1codeCode that identifies the filter
.... descriptionΣ0..1stringHow or why the filter is used
.... operatorΣ1..*code= | is-a | descendent-of | is-not-a | regex | in | not-in | generalizes | exists
FilterOperator (Required)
.... valueΣ1..1stringWhat to use for the value
... propertyΣ0..*BackboneElementAdditional information supplied about each concept
.... codeΣ1..1codeIdentifies the property on the concepts, and when referred to in operations
.... uriΣ0..1uriFormal identifier for the property
.... descriptionΣ0..1stringWhy the property is defined, and/or what it conveys
.... typeΣ1..1codecode | Coding | string | integer | boolean | dateTime | decimal
PropertyType (Required)
... concept0..*BackboneElementConcepts in the code system
.... code1..1codeCode that identifies concept
.... display0..1stringText to display to the user
.... definition0..1stringFormal definition
.... designation0..*BackboneElementAdditional representations for the concept
..... language0..1codeHuman language of the designation
Common Languages (Preferred but limited to AllLanguages)
..... use0..1CodingDetails how this designation would be used
Designation Use (Extensible)
..... value1..1stringThe text value for this designation
.... property0..*BackboneElementProperty value for the concept
..... code1..1codeReference to CodeSystem.property.code
..... value[x]1..1Value of the property for this concept
...... valueCodecode
...... valueCodingCoding
...... valueStringstring
...... valueIntegerinteger
...... valueBooleanboolean
...... valueDateTimedateTime
...... valueDecimaldecimal
.... concept0..*see conceptChild Concepts (is-a/contains/categorizes)
[在此必須假設讀者都有基礎了]

CodeSystem

繼承CanonicalResource(他又繼承DomainResource),所以,會有一堆不在結構上的元素。
這邊補充一下,CanonicalResource是被定義為抽象類別,所以,CodeSystem必須自己去實作他。所以,在結構中,有很多欄位其實是來自CanonicalResource,因為抽象,所以會再出現。
去看CanonicalResource時,會發現有{{title}}的東西,這個就是要等實作類別補上去的。例如說url這個元素,在CanonicalResource的說明是Canonical identifier for this {{title}}, represented as a URI (globally unique),
到了CodeSystem時,其說明變成了Canonical identifier for this code system, represented as a URI (globally unique) (Coding.system)。
元素到copyright基本上都是一致的,也就不用多解釋了。

CodeSystem.caseSensitive

是否區分大小寫。基數0..1。資料型態是boolean。若沒有題供內容值,上傳者應該要遵守大小寫不同之的原則。

CodeSystem.valueSet

指向valueSet。基數0..1。資料型態是canonical(ValueSet)。也就是有一個Resource ValueSet用來代表這整個codeSystem所維護的內容值。

CodeSystem.hierarchyMeaning

此CodeSystem在Concept之結構意義。基數0..1。資料型態code,綁定CodeSystemHierarchyMeaning (Required)。後面concept元素之下有concept元素,這樣所形成的結構意義是什麼。抱歉,也不是很懂。這個範例有用到
Example NameidFormat
Canonical Definition for SNOMED CTsnomedctXMLJSONTurtle
CodeDisplayDefinition
grouped-byGrouped ByNo particular relationship between the concepts can be assumed, except what can be determined by inspection of the definitions of the elements (possible reasons to use this: importing from a source where this is not defined, or where various parts of the hierarchy have different meanings).
is-aIs-AA hierarchy where the child concepts have an IS-A relationship with the parents - that is, all the properties of the parent are also true for its child concepts. Not that is-a is a property of the concepts, so additional subsumption relationships may be defined using properties or the [subsumes](extension-codesystem-subsumes.html) extension.
part-ofPart OfChild elements list the individual parts of a composite whole (e.g. body site).
classified-withClassified WithChild concepts in the hierarchy may have only one parent, and there is a presumption that the code system is a "closed world" meaning all things must be in the hierarchy. This results in concepts such as "not otherwise classified.".

CodeSystem.compositional

此CodeSystem是否採用compositional語法。抱歉,不懂。

CodeSystem.versionNeeded

此CodeSystem是否需要版本定義。基數0..1,資料型態boolean。當此CodeSystem尚未穩定時,就需要使用版本管控資訊。

CodeSystem.content

此CodeSystem的內容值(concepts)目前處於什麼狀態。基數1..1,資料型態code,綁定CodeSystemContentMode (Required)。這是必要欄位,

CodeDisplayDefinition
not-presentNot PresentNone of the concepts defined by the code system are included in the code system resource.
exampleExampleA few representative concepts are included in the code system resource. There is no useful intent in the subset choice and there's no process to make it workable: it's not intended to be workable.
fragmentFragmentA subset of the code system concepts are included in the code system resource. This is a curated subset released for a specific purpose under the governance of the code system steward, and that the intent, bounds and consequences of the fragmentation are clearly defined in the fragment or the code system documentation. Fragments are also known as partitions.
completeCompleteAll the concepts defined by the code system are included in the code system resource.
supplementSupplementThe resource doesn't define any new concepts; it just provides additional designations and properties to another code system.

CodeSystem.supplements

此CodeSystem的補充說明。基數0..1,資料型態是cannonical(CodeSystem)。一般會補充CodeSystem的情境是增加其他語言支援。

CodeSystem.count

此CodySystem包含幾個Concept。基數0..1,資料型態是unsignedInt。

CodeSystem.filter

篩檢器。基數為0..*,資料型態為BackboneElement。可用來定義過濾篩檢現在Concept。

CodeSystem.filter.code

代碼。基數1..1,資料型態code。若要用filter此編碼就一定要給。這個會被用在ValueSet.composel.include.filter。

CodeSystem.filter.description

filter描述。基數0..1。

CodeSystem.filter.operator

運算子。基數1..*,資料型態code,綁定FilterOperator (Required)。
CodeDisplayDefinition
=EqualsThe specified property of the code equals the provided value.
is-aIs A (by subsumption)Includes all concept ids that have a transitive is-a relationship with the concept Id provided as the value, including the provided concept itself (include descendant codes and self).
descendent-ofDescendent Of (by subsumption)Includes all concept ids that have a transitive is-a relationship with the concept Id provided as the value, excluding the provided concept itself i.e. include descendant codes only).
is-not-aNot (Is A) (by subsumption)The specified property of the code does not have an is-a relationship with the provided value.
regexRegular ExpressionThe specified property of the code matches the regex specified in the provided value.
inIn SetThe specified property of the code is in the set of codes or concepts specified in the provided value (comma separated list).
not-inNot in SetThe specified property of the code is not in the set of codes or concepts specified in the provided value (comma separated list).
generalizesGeneralizes (by Subsumption)Includes all concept ids that have a transitive is-a relationship from the concept Id provided as the value, including the provided concept itself (i.e. include ancestor codes and self).
existsExistsThe specified property of the code has at least one value (if the specified value is true; if the specified value is false, then matches when the specified property of the code has no values).

CodeSystem.filter.value

此過濾器內容值。基數1..1,資料型態string。

CodeSystem.property

提供更多關於concept的資訊。基數為0..*,資料型態為BackboneElement。[抱歉,還沒有理解]

CodeSystem.concept

此CodeSystem要維護的內容。基數0..*,資料型態為BackboneElement。
主要是用CodeSystem.concept.code與CodeSystem.concept.display。