CTS2-LE REST API: Update Value Set / Code System
Operation Syntax
POST /service/crud/fhir/terminology-resource/update
- Updates a terminology resource, i. e. value set or code system. If it does not exist, it is created
- Request Body
application/xml- XML input stream of the terminology resource set according to http://www.hl7.org/fhir
- Parameters
- resourceId (type:
string, occurrence:optional)- unique CTS2-LE identifier (not an URI) of the terminology resource (also displayed in the navigator); if not stated then the resource itself has to contain the id
- groupName (type:
string, occurrence:optional)- group corresponding to the terminology tree in the navigator; if not stated then the resource itself has to contain the group name
- isDefaultVersion (type:
boolean, occurrence:optional, default:true)- given resource shall be the default version within CTS2-LE
- defaultLanguage (type:
string, occurrence:optional)- defines the default language of the resource
- Responses
application/xml200no errors409errors specified in XML
Additional Info
1. In order to display the VS in the navigator, the group name has to be set as parameter groupName or in the XML input with:
<extension url="ext:groupName">
<valueString value="..."/>
</extension>
where namespace prefix ext is defined by
xmlns:ext=http://semantik.fokus.fraunhofer.de/ehealth/fhir-extensions#
The unique CTS2-LE resource identifier of the value set (also displayed in the navigator) has to be set as parameter resourceId or in the XML input with
<extension url="ext:resourceId">
<valueString value="..."/>
</extension>
The default language of the value set has to be set as query parameter defaultLanguage or in the XML input with
<extension url="ext:language">
<valueCode value="..."/>
</extension>
The value of the XML input takes precedence if both the query parameter and the XML extension are stated. If neither is used to define the default language, "en" is used.
2. According to the FHIR standard the XML input can be a value set composing (case A) or a code system definition (case B). It is transformed to an CTS2 resource R. Note that the pair (resourceUri, version) uniquely defines a value set within CTS2-LE. The resourceUri and the version is given by the XML item 'url/@value' resp. 'version/@value'.
Input Specification by Example
Below an commented example of an XML input is shown if a value set is
composed (case A). The unique identifier is value-set-stu3-99 and the resource URI is urn:oid:1.2.3.4.55
1 <?xml version="1.0" encoding="UTF-8"?>
2 <ValueSet xmlns="http://hl7.org/fhir" xmlns:xhtml="http://www.w3.org/1999/xhtml"
3 xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 xmlns:ext="http://semantik.fokus.fraunhofer.de/ehealth/fhir-extensions#"
5 xsi:schemaLocation="http://hl7.org/fhir ../fhir-std/spec-v1.8.0/valueset.xsd ">
6
7 <!-- in general, FHIR-extensions are used for items currently not present
8 in FHIR. Then namespace "http://semantik.fokus.fraunhofer.de/ehealth/fhir-extensions#"
9 (see above) has to be used -->
10
11 <!-- group corresponding to the terminology tree in the navigator: -->
12 <extension url="ext:groupName">
13 <valueString value="EXA-vs" />
14 </extension>
15
16 <!-- The intended unique Cts2LE identifier of the value set: -->
17 <extension url="ext:resourceId">
18 <valueString value="value-set-stu3-99" />
19 </extension>
20
21 <!-- An absolute URL that is used to identify this code system. This SHALL
22 be a URL, SHOULD be globally unique, and SHOULD be an address at which this
23 code system is (or will be) published -->
24 <url value="http://test/stu3/vs" />
25 <identifier>
26 <!-- Establishes the namespace in which set of possible id values is unique.
27 Here the namespace for URIs is used. So far only the following namespace
28 is allowed. -->
29 <system value="urn:ietf:rfc:3986" />
30 <!-- The portion of the identifier typically displayed to the user and
31 which is unique within the context of the system above: -->
32 <value value="urn:oid:1.2.3.4.55" />
33 <!-- In context of Cts2LE: the element 'system urn:ietf:rfc:3986' can be
34 omitted -->
35 </identifier>
36 <version value="2017-01" />
37 <status value="draft" />
38
39 <publisher value="fhg ehealth" />
40
41 <description value="... descr ..." />
42 <copyright value="Fhg/Fokus" />
43
44 <!-- so far only 'codeSystem' XOR 'compose' allowed -->
45 <compose>
46 <!-- so far only 'include' allowed -->
47 <include>
48 <!-- The code system from which the selected codes come from (an OID of
49 form 'urn:oid:1.2.3' or a general URI): -->
50 <system value="example:terminology" />
51 <version value="1.0" />
52 <concept>
53 <code value="a01" />
54 <!-- Althought problematic from the semantics perspective (because the
55 codesystem is responsible for designations), one can define a display name
56 for a concept -->
57 <display value="this is a VS specific display" />
58 </concept>
59 <concept>
60 <code value="b01" />
61 </concept>
62 </include>
63 <include>
64 <!-- including a whole code system: -->
65 <system value="http://test/vs" />
66 <version value="2015-11-01" />
67 </include>
68 </compose>
69
70 </ValueSet>
Below a fragment of composing a value set by a filter is shown. I refers to the code system code-system-stu3-88 defined below.
1 ...
2 <compose>
3 <include>
4 <system value="http://test/stu3/cs"/>
5 <version value="2017-01"/>
6 <!-- currently, only one filter allowed -->
7 <filter>
8 <!-- the property name defined in the code system by XML path
9 'CodeSystem/property/code'; currently, only properties of
10 value type 'string' allowed -->
11 <property value="prop"/>
12 <!-- currently, only operator '=' allowed -->
13 <op value="="/>
14 <value value="val1"/>
15 </filter>
16 </include>
17 </compose>
18 ...
Below an commented example of an XML input is shown if a code system is defined (case B). The unique identifier code-system-stu3-88 and the resource URI is http://test/stu3/cs
1 <?xml version="1.0" encoding="UTF-8"?>
2 <CodeSystem xmlns="http://hl7.org/fhir" xmlns:xhtml="http://www.w3.org/1999/xhtml"
3 xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 xmlns:ext="http://semantik.fokus.fraunhofer.de/ehealth/fhir-extensions#"
5 xsi:schemaLocation="http://hl7.org/fhir ../fhir-std/spec-v1.8.0/codesystem.xsd ">
6
7 <!-- in general, FHIR-extensions are used for items currently not present
8 in FHIR. Then namespace "http://semantik.fokus.fraunhofer.de/ehealth/fhir-extensions#"
9 (see above) has to be used -->
10
11 <!-- group corresponding to the terminology tree in the navigator -->
12 <extension url="ext:groupName">
13 <valueString value="EXA" />
14 </extension>
15
16 <!-- The intended unique Cts2LE identifier (not an URI) of the code system
17 (also displayed in the navigator) -->
18 <extension url="ext:resourceId">
19 <valueString value="code-system-stu3-88" />
20 </extension>
21
22 <extension url="ext:language">
23 <!-- Default language of the code system in form of IETF language tags
24 (RFC 5646). This is the language for the display element of a concept -->
25 <valueCode value="en" />
26 </extension>
27
28 <!-- An absolute URL that is used to identify this code system. This SHALL
29 be a URL, SHOULD be globally unique, and SHOULD be an address at which this
30 code system is (or will be) published -->
31 <url value="http://test/stu3/cs" />
32 <!-- Alternative identifiers (because 'url' should be an URL, this element
33 should be used to state an OID of form 'urn:oid:1.2.3' ) -->
34 <identifier>
35 <!-- Establishes the namespace in which set of possible id values is unique.
36 So far only the following namespace is allowed -->
37 <system value="urn:ietf:rfc:3986" />
38 <value value="urn:oid:1.2.3.44" />
39 <!-- In context of Cts2LE: the element 'system urn:ietf:rfc:3986' can be
40 omitted -->
41 </identifier>
42
43 <version value="2017-01" />
44
45 <name value="vs-test" />
46 <status value="draft" />
47 <publisher value="fhg ehealth" />
48
49 <description value="... descr ..." />
50 <copyright value="Fhg/Fokus" />
51
52 <content value="complete" />
53
54 <property>
55 <code value="newRel" />
56 <uri value="http://my/new#rel" />
57 <!-- 'Coding' should be used if the property value is a code of an external
58 code system -->
59 <type value="Coding" />
60 </property>
61
62 <property>
63 <code value="seeAlso" />
64 <uri value="http://www.w3.org/1999/02/22-rdf-syntax-ns#seeAlso" />
65 <!-- 'code' should be used if the property value is a code of this code
66 system -->
67 <type value="code" />
68 </property>
69
70 <property>
71 <code value="prop" />
72 <uri value="http://my/new#prop" />
73 <!-- the property value is a literal -->
74 <type value="string" />
75 </property>
76
77 <concept>
78 <code value="1" />
79 <!-- display (=preferred designation) in the default code system language
80 (see above) -->
81 <display value="designation-1" />
82 <!-- definition in the default code system language -->
83 <definition value="... this is ..." />
84 <designation>
85 <!-- preferred designation in the language 'de' -->
86 <language value="de" />
87 <!-- designation usage; if omitted then usage 'Synonym' (s. below) is chosen -->
88 <use>
89 <system value="http://snomed.info/sct" />
90 <!-- mapping to CTS2 : 900000000000003001 (Fully specified name) -> PREFERRED;
91 900000000000013009 (Synonym) -> ALTERNATIVE -->
92 <code value="900000000000003001" />
93 </use>
94 <value value="designation-1-syn-1-üöä" />
95 </designation>
96 <designation>
97 <!-- this designation act as the definition of the concept in the language
98 'de' -->
99 <language value="de" />
100 <use>
101 <system value="http://snomed.info/sct" />
102 <code value="900000000000550004" />
103 </use>
104 <value value="... dies ist ..." />
105 </designation>
106 <designation>
107 <!-- no language element: default code system language is used -->
108 <use>
109 <system value="http://snomed.info/sct" />
110 <code value="900000000000013009" />
111 </use>
112 <value value="designation-1-syn-2" />
113 </designation>
114 <!-- sub concepts of concept with code 1 -->
115 <concept>
116 <code value="1.1" />
117 <display value="designation-11" />
118 <!-- possible inclusion of extern links -->
119 <definition
120 value="def1.1 <a href='http://www.fokus.fraunhofer.de'>fokus</a>" />
121 <property>
122 <code value="newRel" />
123 <valueCoding>
124 <!-- the URI of the external code system; in the context of Cts2LE it
125 is required that the URI is the preferred one (shown in bold in the navigator) -->
126 <system value="example:terminology" />
127 <!-- in the context of Cts2LE it is required to state the version -->
128 <version value="1.0" />
129 <code value="a01" />
130 </valueCoding>
131 </property>
132 <property>
133 <code value="prop" />
134 <valueString value="val1" />
135 </property>
136 <concept>
137 <code value="1.1.1" />
138 </concept>
139 </concept>
140 </concept>
141 <concept>
142 <code value="2" />
143 <display value="designation-2" />
144 </concept>
145 <concept>
146 <code value="3" />
147 <property>
148 <!-- internal relation -->
149 <code value="seeAlso" />
150 <valueCode value="1" />
151 </property>
152 <!-- properties with simple string values (multi-valued properties are
153 allowed) -->
154 <property>
155 <code value="prop" />
156 <valueString value="val1" />
157 </property>
158 <property>
159 <code value="prop" />
160 <valueString value="val2" />
161 </property>
162 </concept>
163 </CodeSystem>