Work on #534
This commit is contained in:
parent
93cfb2360c
commit
3ecfbf098f
|
@ -32,6 +32,20 @@ import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor;
|
|||
|
||||
public class DaoConfig {
|
||||
|
||||
/**
|
||||
* Default {@link #getTreatReferencesAsLogical() logical URL bases}. Includes the following
|
||||
* values:
|
||||
* <ul>
|
||||
* <li><code>"http://hl7.org/fhir/valueset-*"</code></li>
|
||||
* <li><code>"http://hl7.org/fhir/codesystem-*"</code></li>
|
||||
* <li><code>"http://hl7.org/fhir/StructureDefinition/*"</code></li>
|
||||
* </ul>
|
||||
*/
|
||||
public static final Set<String> DEFAULT_LOGICAL_BASE_URLS = Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(
|
||||
"http://hl7.org/fhir/valueset-*",
|
||||
"http://hl7.org/fhir/codesystem-*",
|
||||
"http://hl7.org/fhir/StructureDefinition/*")));
|
||||
|
||||
// ***
|
||||
// update setter javadoc if default changes
|
||||
// ***
|
||||
|
@ -41,13 +55,13 @@ public class DaoConfig {
|
|||
// update setter javadoc if default changes
|
||||
// ***
|
||||
private boolean myAllowInlineMatchUrlReferences = false;
|
||||
|
||||
private boolean myAllowMultipleDelete;
|
||||
private boolean myDefaultSearchParamsCanBeOverridden = false;
|
||||
// ***
|
||||
// update setter javadoc if default changes
|
||||
// ***
|
||||
private int myDeferIndexingForCodesystemsOfSize = 2000;
|
||||
|
||||
private boolean myDeleteStaleSearches = true;
|
||||
|
||||
// ***
|
||||
|
@ -63,24 +77,19 @@ public class DaoConfig {
|
|||
// update setter javadoc if default changes
|
||||
// ***
|
||||
private boolean myIndexContainedResources = true;
|
||||
|
||||
private List<IServerInterceptor> myInterceptors;
|
||||
|
||||
// ***
|
||||
// update setter javadoc if default changes
|
||||
// ***
|
||||
private int myMaximumExpansionSize = 5000;
|
||||
|
||||
private ResourceEncodingEnum myResourceEncoding = ResourceEncodingEnum.JSONC;
|
||||
|
||||
private boolean mySchedulingDisabled;
|
||||
|
||||
private boolean mySubscriptionEnabled;
|
||||
|
||||
private long mySubscriptionPollDelay = 1000;
|
||||
|
||||
private Long mySubscriptionPurgeInactiveAfterMillis;
|
||||
|
||||
private Set<String> myTreatBaseUrlsAsLocal = new HashSet<String>();
|
||||
private Set<String> myTreatReferencesAsLogical = new HashSet<String>(DEFAULT_LOGICAL_BASE_URLS);
|
||||
|
||||
/**
|
||||
* When a code system is added that contains more than this number of codes,
|
||||
|
@ -169,11 +178,41 @@ public class DaoConfig {
|
|||
* <code>http://example.com/base/Patient/1</code>, the server will automatically
|
||||
* convert this reference to <code>Patient/1</code>
|
||||
* </p>
|
||||
* <p>
|
||||
* Note that this property has different behaviour from {@link DaoConfig#getTreatReferencesAsLogical()}
|
||||
* </p>
|
||||
*
|
||||
* @see #getTreatReferencesAsLogical()
|
||||
*/
|
||||
public Set<String> getTreatBaseUrlsAsLocal() {
|
||||
return myTreatBaseUrlsAsLocal;
|
||||
}
|
||||
|
||||
/**
|
||||
* This setting may be used to advise the server that any references found in
|
||||
* resources that have any of the base URLs given here will be treated as logical
|
||||
* references instead of being treated as real references.
|
||||
* <p>
|
||||
* A logical reference is a reference which is treated as an identifier, and
|
||||
* does not neccesarily resolve. See {@link http://hl7.org/fhir/references.html} for
|
||||
* a description of logical references. For example, the valueset
|
||||
* {@link http://hl7.org/fhir/valueset-quantity-comparator.html} is a logical
|
||||
* reference.
|
||||
* </p>
|
||||
* <p>
|
||||
* Values for this field may take either of the following forms:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li><code>http://example.com/some-url</code> <b>(will be matched exactly)</b></li>
|
||||
* <li><code>http://example.com/some-base*</code> <b>(will match anything beginning with the part before the *)</b></li>
|
||||
* </ul>
|
||||
*
|
||||
* @see #DEFAULT_LOGICAL_BASE_URLS for a list of default values for this setting
|
||||
*/
|
||||
public Set<String> getTreatReferencesAsLogical() {
|
||||
return myTreatReferencesAsLogical;
|
||||
}
|
||||
|
||||
/**
|
||||
* If set to <code>true</code> (default is <code>false</code>) the server will allow
|
||||
* resources to have references to external servers. For example if this server is
|
||||
|
@ -497,4 +536,30 @@ public class DaoConfig {
|
|||
myTreatBaseUrlsAsLocal = treatBaseUrlsAsLocal;
|
||||
}
|
||||
|
||||
/**
|
||||
* This setting may be used to advise the server that any references found in
|
||||
* resources that have any of the base URLs given here will be treated as logical
|
||||
* references instead of being treated as real references.
|
||||
* <p>
|
||||
* A logical reference is a reference which is treated as an identifier, and
|
||||
* does not neccesarily resolve. See {@link http://hl7.org/fhir/references.html} for
|
||||
* a description of logical references. For example, the valueset
|
||||
* {@link http://hl7.org/fhir/valueset-quantity-comparator.html} is a logical
|
||||
* reference.
|
||||
* </p>
|
||||
* <p>
|
||||
* Values for this field may take either of the following forms:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li><code>http://example.com/some-url</code> <b>(will be matched exactly)</b></li>
|
||||
* <li><code>http://example.com/some-base*</code> <b>(will match anything beginning with the part before the *)</b></li>
|
||||
* </ul>
|
||||
*
|
||||
* @see #DEFAULT_LOGICAL_BASE_URLS for a list of default values for this setting
|
||||
*/
|
||||
public DaoConfig setTreatReferencesAsLogical(Set<String> theTreatReferencesAsLogical) {
|
||||
myTreatReferencesAsLogical = theTreatReferencesAsLogical;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import static org.mockito.Mockito.reset;
|
|||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
|
@ -69,6 +70,16 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
|
|||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
/**
|
||||
* See #534
|
||||
*/
|
||||
@Test
|
||||
public void testBuiltInLogicalReferences() throws IOException {
|
||||
|
||||
StructureDefinition sd = loadResourceFromClasspath(StructureDefinition.class, "/issue534/bw_profile_snapshot.xml");
|
||||
myStructureDefinitionDao.create(sd, mySrd);
|
||||
}
|
||||
|
||||
|
||||
private void assertGone(IIdType theId) {
|
||||
try {
|
||||
|
|
|
@ -16,20 +16,13 @@ import org.junit.Test;
|
|||
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Bundle;
|
||||
import ca.uhn.fhir.model.dstu2.resource.*;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Bundle.Entry;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Observation;
|
||||
import ca.uhn.fhir.model.dstu2.resource.OperationOutcome;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Organization;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||
import ca.uhn.fhir.model.dstu2.resource.StructureDefinition;
|
||||
import ca.uhn.fhir.model.dstu2.resource.ValueSet;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.ObservationStatusEnum;
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
import ca.uhn.fhir.rest.api.MethodOutcome;
|
||||
import ca.uhn.fhir.rest.api.ValidationModeEnum;
|
||||
import ca.uhn.fhir.rest.server.EncodingEnum;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
||||
|
@ -43,12 +36,11 @@ public class FhirResourceDaoDstu2ValidateTest extends BaseJpaDstu2Test {
|
|||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
myDaoConfig.setAllowExternalReferences(true);
|
||||
}
|
||||
|
||||
|
||||
@After
|
||||
public void after() {
|
||||
myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences());
|
||||
|
@ -110,21 +102,21 @@ public class FhirResourceDaoDstu2ValidateTest extends BaseJpaDstu2Test {
|
|||
case JSON:
|
||||
encoded = myFhirCtx.newJsonParser().encodeResourceToString(input);
|
||||
try {
|
||||
myObservationDao.validate(input, null, encoded, EncodingEnum.JSON, mode, null, mySrd);
|
||||
fail();
|
||||
myObservationDao.validate(input, null, encoded, EncodingEnum.JSON, mode, null, mySrd);
|
||||
fail();
|
||||
} catch (PreconditionFailedException e) {
|
||||
return (OperationOutcome) e.getOperationOutcome();
|
||||
}
|
||||
case XML:
|
||||
encoded = myFhirCtx.newXmlParser().encodeResourceToString(input);
|
||||
try {
|
||||
myObservationDao.validate(input, null, encoded, EncodingEnum.XML, mode, null, mySrd);
|
||||
fail();
|
||||
myObservationDao.validate(input, null, encoded, EncodingEnum.XML, mode, null, mySrd);
|
||||
fail();
|
||||
} catch (PreconditionFailedException e) {
|
||||
return (OperationOutcome) e.getOperationOutcome();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
throw new IllegalStateException(); // shouldn't get here
|
||||
}
|
||||
|
||||
|
@ -144,21 +136,21 @@ public class FhirResourceDaoDstu2ValidateTest extends BaseJpaDstu2Test {
|
|||
ValidationModeEnum mode = ValidationModeEnum.CREATE;
|
||||
String encoded = myFhirCtx.newJsonParser().encodeResourceToString(input);
|
||||
MethodOutcome outcome = myObservationDao.validate(input, null, encoded, EncodingEnum.JSON, mode, null, mySrd);
|
||||
|
||||
|
||||
String ooString = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome.getOperationOutcome());
|
||||
ourLog.info(ooString);
|
||||
assertThat(ooString, containsString("StructureDefinition reference \\\"" + profileUri + "\\\" could not be resolved"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testValidateForCreate() {
|
||||
String methodName = "testValidateForCreate";
|
||||
|
||||
|
||||
Patient pat = new Patient();
|
||||
pat.setId("Patient/123");
|
||||
pat.addName().addFamily(methodName);
|
||||
|
||||
|
||||
try {
|
||||
myPatientDao.validate(pat, null, null, null, ValidationModeEnum.CREATE, null, mySrd);
|
||||
fail();
|
||||
|
@ -170,18 +162,18 @@ public class FhirResourceDaoDstu2ValidateTest extends BaseJpaDstu2Test {
|
|||
myPatientDao.validate(pat, null, null, null, ValidationModeEnum.CREATE, null, mySrd);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testValidateForUpdate() {
|
||||
String methodName = "testValidateForUpdate";
|
||||
|
||||
|
||||
Patient pat = new Patient();
|
||||
pat.setId("Patient/123");
|
||||
pat.addName().addFamily(methodName);
|
||||
myPatientDao.validate(pat, null, null, null, ValidationModeEnum.UPDATE, null, mySrd);
|
||||
|
||||
pat.setId("");
|
||||
|
||||
|
||||
try {
|
||||
myPatientDao.validate(pat, null, null, null, ValidationModeEnum.UPDATE, null, mySrd);
|
||||
fail();
|
||||
|
@ -194,17 +186,17 @@ public class FhirResourceDaoDstu2ValidateTest extends BaseJpaDstu2Test {
|
|||
@Test
|
||||
public void testValidateForUpdateWithContained() {
|
||||
String methodName = "testValidateForUpdate";
|
||||
|
||||
|
||||
Organization org = new Organization();
|
||||
org.setId("#123");
|
||||
|
||||
|
||||
Patient pat = new Patient();
|
||||
pat.setId("Patient/123");
|
||||
pat.addName().addFamily(methodName);
|
||||
myPatientDao.validate(pat, null, null, null, ValidationModeEnum.UPDATE, null, mySrd);
|
||||
|
||||
pat.setId("");
|
||||
|
||||
|
||||
try {
|
||||
myPatientDao.validate(pat, null, null, null, ValidationModeEnum.UPDATE, null, mySrd);
|
||||
fail();
|
||||
|
@ -214,26 +206,25 @@ public class FhirResourceDaoDstu2ValidateTest extends BaseJpaDstu2Test {
|
|||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testValidateForDelete() {
|
||||
String methodName = "testValidateForDelete";
|
||||
|
||||
|
||||
Organization org = new Organization();
|
||||
org.setName(methodName);
|
||||
IIdType orgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless();
|
||||
|
||||
|
||||
Patient pat = new Patient();
|
||||
pat.addName().addFamily(methodName);
|
||||
pat.getManagingOrganization().setReference(orgId);
|
||||
IIdType patId = myPatientDao.create(pat, mySrd).getId().toUnqualifiedVersionless();
|
||||
|
||||
OperationOutcome outcome=null;
|
||||
|
||||
OperationOutcome outcome = null;
|
||||
try {
|
||||
myOrganizationDao.validate(null, orgId, null, null, ValidationModeEnum.DELETE, null, mySrd);
|
||||
fail();
|
||||
} catch (ResourceVersionConflictException e) {
|
||||
outcome= (OperationOutcome) e.getOperationOutcome();
|
||||
outcome = (OperationOutcome) e.getOperationOutcome();
|
||||
}
|
||||
|
||||
String ooString = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,362 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<StructureDefinition xmlns="http://hl7.org/fhir">
|
||||
<url value="http://phr.kanta.fi/StructureDefinition/testi" />
|
||||
<name value="testi" />
|
||||
<status value="draft" />
|
||||
<fhirVersion value="1.0.2" />
|
||||
<kind value="datatype" />
|
||||
<constrainedType value="Quantity" />
|
||||
<abstract value="false" />
|
||||
<base value="http://hl7.org/fhir/StructureDefinition/Quantity" />
|
||||
<snapshot>
|
||||
<element>
|
||||
<path value="Quantity" />
|
||||
<short value="A measured or measurable amount" />
|
||||
<definition value="A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies." />
|
||||
<comments value="The context of use may frequently define what kind of quantity this is and therefore what kind of units can be used. The context of use may also restrict the values for the comparator." />
|
||||
<min value="0" />
|
||||
<max value="*" />
|
||||
<base>
|
||||
<path value="Quantity" />
|
||||
<min value="0" />
|
||||
<max value="*" />
|
||||
</base>
|
||||
<type>
|
||||
<code value="Quantity" />
|
||||
</type>
|
||||
<constraint>
|
||||
<key value="qty-3" />
|
||||
<severity value="error" />
|
||||
<human value="If a code for the unit is present, the system SHALL also be present" />
|
||||
<xpath value="not(exists(f:code)) or exists(f:system)" />
|
||||
</constraint>
|
||||
<isSummary value="true" />
|
||||
<mapping>
|
||||
<identity value="v2" />
|
||||
<map value="SN (see also Range) or CQ" />
|
||||
</mapping>
|
||||
<mapping>
|
||||
<identity value="rim" />
|
||||
<map value="PQ, IVL<PQ>, MO, CO, depending on the values" />
|
||||
</mapping>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Quantity.id" />
|
||||
<representation value="xmlAttr" />
|
||||
<short value="xml:id (or equivalent in JSON)" />
|
||||
<definition value="unique id for the element within a resource (for internal references)." />
|
||||
<min value="0" />
|
||||
<max value="1" />
|
||||
<base>
|
||||
<path value="Quantity.id" />
|
||||
<min value="0" />
|
||||
<max value="1" />
|
||||
</base>
|
||||
<type>
|
||||
<code value="id" />
|
||||
</type>
|
||||
<mapping>
|
||||
<identity value="rim" />
|
||||
<map value="n/a" />
|
||||
</mapping>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Quantity.extension" />
|
||||
<short value="Additional Content defined by implementations" />
|
||||
<definition value="May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." />
|
||||
<comments value="There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone." />
|
||||
<alias value="extensions" />
|
||||
<alias value="user content" />
|
||||
<min value="0" />
|
||||
<max value="*" />
|
||||
<base>
|
||||
<path value="Quantity.extension" />
|
||||
<min value="0" />
|
||||
<max value="*" />
|
||||
</base>
|
||||
<type>
|
||||
<code value="Extension" />
|
||||
</type>
|
||||
<mapping>
|
||||
<identity value="rim" />
|
||||
<map value="n/a" />
|
||||
</mapping>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Quantity.value" />
|
||||
<short value="Numerical value (with implicit precision)" />
|
||||
<definition value="The value of the measured amount. The value includes an implicit precision in the presentation of the value." />
|
||||
<comments value="The implicit precision in the value should always be honored. Monetary values have their own rules for handling precision (refer to standard accounting text books)." />
|
||||
<requirements value="Precision is handled implicitly in almost all cases of measurement." />
|
||||
<min value="1" />
|
||||
<max value="1" />
|
||||
<base>
|
||||
<path value="Quantity.value" />
|
||||
<min value="0" />
|
||||
<max value="1" />
|
||||
</base>
|
||||
<type>
|
||||
<code value="decimal" />
|
||||
</type>
|
||||
<isSummary value="true" />
|
||||
<mapping>
|
||||
<identity value="v2" />
|
||||
<map value="SN.2 / CQ - N/A" />
|
||||
</mapping>
|
||||
<mapping>
|
||||
<identity value="rim" />
|
||||
<map value="PQ.value, CO.value, MO.value, IVL.high or IVL.low depending on the value" />
|
||||
</mapping>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Quantity.comparator" />
|
||||
<short value="< | <= | >= | > - how to understand the value" />
|
||||
<definition value="How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is "<" , then the real value is < stated value." />
|
||||
<comments value="This is labeled as "Is Modifier" because the comparator modifies the interpretation of the value significantly. If there is no comparator, then there is no modification of the value." />
|
||||
<requirements value="Need a framework for handling measures where the value is <5ug/L or >400mg/L due to the limitations of measuring methodology." />
|
||||
<min value="0" />
|
||||
<max value="1" />
|
||||
<base>
|
||||
<path value="Quantity.comparator" />
|
||||
<min value="0" />
|
||||
<max value="1" />
|
||||
</base>
|
||||
<type>
|
||||
<code value="code" />
|
||||
</type>
|
||||
<meaningWhenMissing value="If there is no comparator, then there is no modification of the value" />
|
||||
<isModifier value="true" />
|
||||
<isSummary value="true" />
|
||||
<binding>
|
||||
<strength value="required" />
|
||||
<description value="How the Quantity should be understood and represented." />
|
||||
<valueSetReference>
|
||||
<reference value="http://hl7.org/fhir/ValueSet/quantity-comparator" />
|
||||
</valueSetReference>
|
||||
</binding>
|
||||
<mapping>
|
||||
<identity value="v2" />
|
||||
<map value="SN.1 / CQ.1" />
|
||||
</mapping>
|
||||
<mapping>
|
||||
<identity value="rim" />
|
||||
<map value="IVL properties" />
|
||||
</mapping>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Quantity.unit" />
|
||||
<short value="Unit representation" />
|
||||
<definition value="A human-readable form of the unit." />
|
||||
<requirements value="There are many representations for units of measure and in many contexts, particular representations are fixed and required. I.e. mcg for micrograms." />
|
||||
<min value="1" />
|
||||
<max value="1" />
|
||||
<base>
|
||||
<path value="Quantity.unit" />
|
||||
<min value="0" />
|
||||
<max value="1" />
|
||||
</base>
|
||||
<type>
|
||||
<code value="string" />
|
||||
</type>
|
||||
<fixedString value="L/min" />
|
||||
<isSummary value="true" />
|
||||
<mapping>
|
||||
<identity value="v2" />
|
||||
<map value="(see OBX.6 etc.) / CQ.2" />
|
||||
</mapping>
|
||||
<mapping>
|
||||
<identity value="rim" />
|
||||
<map value="PQ.unit" />
|
||||
</mapping>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Quantity.system" />
|
||||
<short value="System that defines coded unit form" />
|
||||
<definition value="The identification of the system that provides the coded form of the unit." />
|
||||
<requirements value="Need to know the system that defines the coded form of the unit." />
|
||||
<min value="0" />
|
||||
<max value="0" />
|
||||
<base>
|
||||
<path value="Quantity.system" />
|
||||
<min value="0" />
|
||||
<max value="1" />
|
||||
</base>
|
||||
<type>
|
||||
<code value="uri" />
|
||||
</type>
|
||||
<condition value="qty-3" />
|
||||
<isSummary value="true" />
|
||||
<mapping>
|
||||
<identity value="v2" />
|
||||
<map value="(see OBX.6 etc.) / CQ.2" />
|
||||
</mapping>
|
||||
<mapping>
|
||||
<identity value="rim" />
|
||||
<map value="CO.codeSystem, PQ.translation.codeSystem" />
|
||||
</mapping>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Quantity.code" />
|
||||
<short value="Coded form of the unit" />
|
||||
<definition value="A computer processable form of the unit in some unit representation system." />
|
||||
<comments value="The preferred system is UCUM, but SNOMED CT can also be used (for customary units) or ISO 4217 for currency. The context of use may additionally require a code from a particular system." />
|
||||
<requirements value="Need a computable form of the unit that is fixed across all forms. UCUM provides this for quantities, but SNOMED CT provides many units of interest." />
|
||||
<min value="0" />
|
||||
<max value="0" />
|
||||
<base>
|
||||
<path value="Quantity.code" />
|
||||
<min value="0" />
|
||||
<max value="1" />
|
||||
</base>
|
||||
<type>
|
||||
<code value="code" />
|
||||
</type>
|
||||
<isSummary value="true" />
|
||||
<mapping>
|
||||
<identity value="v2" />
|
||||
<map value="(see OBX.6 etc.) / CQ.2" />
|
||||
</mapping>
|
||||
<mapping>
|
||||
<identity value="rim" />
|
||||
<map value="PQ.code, MO.currency, PQ.translation.code" />
|
||||
</mapping>
|
||||
</element>
|
||||
</snapshot>
|
||||
<differential>
|
||||
<element>
|
||||
<path value="Quantity" />
|
||||
<short value="A measured or measurable amount" />
|
||||
<definition value="A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies." />
|
||||
<comments value="The context of use may frequently define what kind of quantity this is and therefore what kind of units can be used. The context of use may also restrict the values for the comparator." />
|
||||
<min value="0" />
|
||||
<max value="*" />
|
||||
<base>
|
||||
<path value="Quantity" />
|
||||
<min value="0" />
|
||||
<max value="*" />
|
||||
</base>
|
||||
<type>
|
||||
<code value="Quantity" />
|
||||
</type>
|
||||
<constraint>
|
||||
<key value="qty-3" />
|
||||
<severity value="error" />
|
||||
<human value="If a code for the unit is present, the system SHALL also be present" />
|
||||
<xpath value="not(exists(f:code)) or exists(f:system)" />
|
||||
</constraint>
|
||||
<isSummary value="true" />
|
||||
<mapping>
|
||||
<identity value="v2" />
|
||||
<map value="SN (see also Range) or CQ" />
|
||||
</mapping>
|
||||
<mapping>
|
||||
<identity value="rim" />
|
||||
<map value="PQ, IVL<PQ>, MO, CO, depending on the values" />
|
||||
</mapping>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Quantity.value" />
|
||||
<short value="Numerical value (with implicit precision)" />
|
||||
<definition value="The value of the measured amount. The value includes an implicit precision in the presentation of the value." />
|
||||
<comments value="The implicit precision in the value should always be honored. Monetary values have their own rules for handling precision (refer to standard accounting text books)." />
|
||||
<requirements value="Precision is handled implicitly in almost all cases of measurement." />
|
||||
<min value="1" />
|
||||
<max value="1" />
|
||||
<base>
|
||||
<path value="Quantity.value" />
|
||||
<min value="0" />
|
||||
<max value="1" />
|
||||
</base>
|
||||
<type>
|
||||
<code value="decimal" />
|
||||
</type>
|
||||
<isSummary value="true" />
|
||||
<mapping>
|
||||
<identity value="v2" />
|
||||
<map value="SN.2 / CQ - N/A" />
|
||||
</mapping>
|
||||
<mapping>
|
||||
<identity value="rim" />
|
||||
<map value="PQ.value, CO.value, MO.value, IVL.high or IVL.low depending on the value" />
|
||||
</mapping>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Quantity.unit" />
|
||||
<short value="Unit representation" />
|
||||
<definition value="A human-readable form of the unit." />
|
||||
<requirements value="There are many representations for units of measure and in many contexts, particular representations are fixed and required. I.e. mcg for micrograms." />
|
||||
<min value="1" />
|
||||
<max value="1" />
|
||||
<base>
|
||||
<path value="Quantity.unit" />
|
||||
<min value="0" />
|
||||
<max value="1" />
|
||||
</base>
|
||||
<type>
|
||||
<code value="string" />
|
||||
</type>
|
||||
<fixedString value="L/min" />
|
||||
<isSummary value="true" />
|
||||
<mapping>
|
||||
<identity value="v2" />
|
||||
<map value="(see OBX.6 etc.) / CQ.2" />
|
||||
</mapping>
|
||||
<mapping>
|
||||
<identity value="rim" />
|
||||
<map value="PQ.unit" />
|
||||
</mapping>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Quantity.system" />
|
||||
<short value="System that defines coded unit form" />
|
||||
<definition value="The identification of the system that provides the coded form of the unit." />
|
||||
<requirements value="Need to know the system that defines the coded form of the unit." />
|
||||
<min value="0" />
|
||||
<max value="0" />
|
||||
<base>
|
||||
<path value="Quantity.system" />
|
||||
<min value="0" />
|
||||
<max value="1" />
|
||||
</base>
|
||||
<type>
|
||||
<code value="uri" />
|
||||
</type>
|
||||
<condition value="qty-3" />
|
||||
<isSummary value="true" />
|
||||
<mapping>
|
||||
<identity value="v2" />
|
||||
<map value="(see OBX.6 etc.) / CQ.2" />
|
||||
</mapping>
|
||||
<mapping>
|
||||
<identity value="rim" />
|
||||
<map value="CO.codeSystem, PQ.translation.codeSystem" />
|
||||
</mapping>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Quantity.code" />
|
||||
<short value="Coded form of the unit" />
|
||||
<definition value="A computer processable form of the unit in some unit representation system." />
|
||||
<comments value="The preferred system is UCUM, but SNOMED CT can also be used (for customary units) or ISO 4217 for currency. The context of use may additionally require a code from a particular system." />
|
||||
<requirements value="Need a computable form of the unit that is fixed across all forms. UCUM provides this for quantities, but SNOMED CT provides many units of interest." />
|
||||
<min value="0" />
|
||||
<max value="0" />
|
||||
<base>
|
||||
<path value="Quantity.code" />
|
||||
<min value="0" />
|
||||
<max value="1" />
|
||||
</base>
|
||||
<type>
|
||||
<code value="code" />
|
||||
</type>
|
||||
<isSummary value="true" />
|
||||
<mapping>
|
||||
<identity value="v2" />
|
||||
<map value="(see OBX.6 etc.) / CQ.2" />
|
||||
</mapping>
|
||||
<mapping>
|
||||
<identity value="rim" />
|
||||
<map value="PQ.code, MO.currency, PQ.translation.code" />
|
||||
</mapping>
|
||||
</element>
|
||||
</differential>
|
||||
</StructureDefinition>
|
|
@ -0,0 +1,46 @@
|
|||
<ValueSet>
|
||||
<id value="ce86ecda-449a-4549-9b23-da29385d842a" />
|
||||
<meta>
|
||||
<versionId value="1" />
|
||||
<lastUpdated value="2017-02-23T08:25:27.174+00:00" />
|
||||
<profile value="http://hl7.org/fhir/StructureDefinition/valueset-shareable-definition" />
|
||||
</meta>
|
||||
<extension url="http://hl7.org/fhir/StructureDefinition/valueset-oid">
|
||||
<valueUri value="urn:oid:2.16.840.1.113883.4.642.2.37" />
|
||||
</extension>
|
||||
<url value="http://phr.kanta.fi/ValueSet/fiphr-vs-bodysite" />
|
||||
<version value="0.01" />
|
||||
<name value="fiphr-vs-bodysite" />
|
||||
<status value="draft" />
|
||||
<experimental value="true" />
|
||||
<publisher value="Kela" />
|
||||
<contact>
|
||||
<telecom>
|
||||
<system value="email" />
|
||||
<value value="kantakehitys@kanta.fi" />
|
||||
</telecom>
|
||||
<telecom>
|
||||
<system value="other" />
|
||||
<value value="http://www.kanta.fi/en/web/ammattilaisille/omakannan-omatietovarannon-maarittelyt" />
|
||||
</telecom>
|
||||
</contact>
|
||||
<date value="2016-11-23T09:00:00+03:00" />
|
||||
<description value="Body Site value set. Early draft" />
|
||||
<codeSystem>
|
||||
<extension url="http://hl7.org/fhir/StructureDefinition/valueset-oid">
|
||||
<valueUri value="urn:oid:2.16.840.1.113883.4.642.1.37" />
|
||||
</extension>
|
||||
<system value="http://phr.kanta.fi/fiphr-vs-bodysite" />
|
||||
<version value="1.0" />
|
||||
<caseSensitive value="true" />
|
||||
<concept>
|
||||
<code value="1020" />
|
||||
<display value="Pää" />
|
||||
<definition value="Pää; draft value" />
|
||||
<designation>
|
||||
<language value="en" />
|
||||
<value value="Pää" />
|
||||
</designation>
|
||||
</concept>
|
||||
</codeSystem>
|
||||
</ValueSet>
|
|
@ -0,0 +1,46 @@
|
|||
<ValueSet>
|
||||
<id value="cace1036-1195-49f4-981e-9e8f3f95ef27" />
|
||||
<meta>
|
||||
<versionId value="5" />
|
||||
<lastUpdated value="2017-03-02T14:04:07.769+00:00" />
|
||||
<profile value="http://hl7.org/fhir/StructureDefinition/valueset-shareable-definition" />
|
||||
</meta>
|
||||
<extension url="http://hl7.org/fhir/StructureDefinition/valueset-oid">
|
||||
<valueUri value="urn:oid:2.16.840.1.113883.4.642.2.37" />
|
||||
</extension>
|
||||
<url value="http://phr.kanta.fi/ValueSet/fiphr-vs-observationmethod" />
|
||||
<version value="0.01" />
|
||||
<name value="fiphr-vs-observationmethod" />
|
||||
<status value="draft" />
|
||||
<experimental value="true" />
|
||||
<publisher value="Kela" />
|
||||
<contact>
|
||||
<telecom>
|
||||
<system value="email" />
|
||||
<value value="kantakehitys@kanta.fi" />
|
||||
</telecom>
|
||||
<telecom>
|
||||
<system value="other" />
|
||||
<value value="http://www.kanta.fi/en/web/ammattilaisille/omakannan-omatietovarannon-maarittelyt" />
|
||||
</telecom>
|
||||
</contact>
|
||||
<date value="2016-11-23T09:00:00+03:00" />
|
||||
<description value="Observation Method value set" />
|
||||
<codeSystem>
|
||||
<extension url="http://hl7.org/fhir/StructureDefinition/valueset-oid">
|
||||
<valueUri value="urn:oid:2.16.840.1.113883.4.642.1.37" />
|
||||
</extension>
|
||||
<system value="http://phr.kanta.fi/fiphr-vs-observationmethod" />
|
||||
<version value="1.0" />
|
||||
<caseSensitive value="true" />
|
||||
<concept>
|
||||
<code value="1" />
|
||||
<display value="place holder" />
|
||||
<definition value="place holder" />
|
||||
<designation>
|
||||
<language value="en" />
|
||||
<value value="place holder" />
|
||||
</designation>
|
||||
</concept>
|
||||
</codeSystem>
|
||||
</ValueSet>
|
Loading…
Reference in New Issue