Skip to content

Commit

Permalink
Update resource defs
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesagnew committed Dec 1, 2015
1 parent 8f41739 commit 547b529
Show file tree
Hide file tree
Showing 289 changed files with 101,026 additions and 55,496 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public interface IQuery<T> extends IClientExecutable<IQuery<T>, T>, IBaseQuery<I
*
* @deprecated This parameter is badly named, since FHIR calls this parameter "_count" and not "_limit". Use {@link #count(int)} instead (it also sets the _count parameter)
*/
@Deprecated
IQuery<T> limitTo(int theLimitTo);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import java.io.IOException;
import java.util.Arrays;

import org.apache.commons.io.IOUtils;
import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
import org.hl7.fhir.instance.model.api.IIdType;
import org.junit.Test;

Expand Down Expand Up @@ -241,5 +243,19 @@ private IResource findResourceByIdInBundle(Bundle vss, String name) {
}
return retVal;
}

@Test
public void testValidateNewQuestionnaireFormat() throws Exception {
String input =IOUtils.toString(FhirResourceDaoDstu21ValidateTest.class.getResourceAsStream("/questionnaire_dstu21.xml"));
try {
MethodOutcome results = myQuestionnaireDao.validate(null, null, input, EncodingEnum.XML, ValidationModeEnum.UPDATE, null);
OperationOutcome oo = (OperationOutcome) results.getOperationOutcome();
ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo));
} catch (PreconditionFailedException e) {
// this is a failure of the test
ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(e.getOperationOutcome()));
throw e;
}
}

}
922 changes: 922 additions & 0 deletions hapi-fhir-jpaserver-base/src/test/resources/questionnaire_dstu21.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ public boolean isCodeSystemSupported(FhirContext theContext, String theSystem) {
@Override
public <T extends IBaseResource> T fetchResource(FhirContext theContext, Class<T> theClass, String theUri) {
if (theUri.startsWith("http://hl7.org/fhir/StructureDefinition/")) {
return (T) FhirInstanceValidator.loadProfileOrReturnNull(null, FhirInstanceValidator.getHl7OrgDstu2Ctx(theContext), theUri.substring("http://hl7.org/fhir/StructureDefinition/".length()));
return (T) FhirInstanceValidator.loadProfileOrReturnNull(null, theContext, theUri.substring("http://hl7.org/fhir/StructureDefinition/".length()));
}
if (theUri.startsWith("http://hl7.org/fhir/ValueSet/")) {
Map<String, ValueSet> defaultValueSets = myDefaultValueSets;
if (defaultValueSets == null) {
InputStream valuesetText = DefaultProfileValidationSupport.class.getResourceAsStream("/org/hl7/fhir/instance/model/valueset/valuesets.xml");
String path = theContext.getVersion().getPathToSchemaDefinitions().replace("/schema", "/valueset") + "/valuesets.xml";
InputStream valuesetText = DefaultProfileValidationSupport.class.getResourceAsStream(path);
if (valuesetText == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ protected List<ValidationMessage> validate(final FhirContext theCtx, String theI
}

v.setBestPracticeWarningLevel(myBestPracticeWarningLevel);
v.setAnyExtensionsAllowed(true);

List<ValidationMessage> messages = new ArrayList<ValidationMessage>();

Expand Down Expand Up @@ -231,7 +232,8 @@ static StructureDefinition loadProfileOrReturnNull(List<ValidationMessage> theMe
return null;
}

String profileCpName = "/org/hl7/fhir/instance/model/profile/" + theResourceName.toLowerCase() + ".profile.xml";
String profileClasspath = theCtx.getVersion().getPathToSchemaDefinitions().replace("/schema", "/profile");
String profileCpName = profileClasspath + '/' + theResourceName.toLowerCase() + ".profile.xml";
String profileText;
try {
InputStream inputStream = FhirInstanceValidator.class.getResourceAsStream(profileCpName);
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
<value value="http://hl7.org/fhir"/>
</telecom>
</contact>
<date value="2015-09-01T19:08:30-04:00"/>
<date value="2015-12-01T11:05:39-05:00"/>
<description value="A duration (length of time) with a UCUM code"/>
<fhirVersion value="1.0.2"/>
<kind value="datatype"/>
<constrainedType value="Quantity"/>
<abstract value="false"/>
Expand All @@ -38,8 +39,8 @@
<short value="A duration (length of time) with a UCUM code"/>
<definition value="There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM. If value is present, it SHALL be positive."/>
<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="1"/>
<max value="1"/>
<min value="0"/>
<max value="*"/>
<base>
<path value="Quantity"/>
<min value="0"/>
Expand All @@ -49,12 +50,18 @@
<code value="Quantity"/>
</type>
<constraint>
<extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
<valueString value="code.empty() or system"/>
</extension>
<key value="qty-3"/>
<severity value="error"/>
<human value="If a code for the units is present, the system SHALL also be present"/>
<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>
<constraint>
<extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
<valueString value="(code or value.empty()) and (system.empty() or system = %ucum) and (value.empty() or value.contains(&#39;.&#39;).not())"/>
</extension>
<key value="age-1"/>
<severity value="error"/>
<human value="There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM. If value is present, it SHALL be positive."/>
Expand Down Expand Up @@ -141,7 +148,7 @@
<element>
<path value="Quantity.comparator"/>
<short value="&lt; | &lt;= | &gt;= | &gt; - 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 &quot;&lt;&quot; , then the real value is &lt; stated 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 &quot;&lt;&quot; , then the real value is &lt; stated value."/>
<comments value="This is labeled as &quot;Is Modifier&quot; 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 &lt;5ug/L or &gt;400mg/L due to the limitations of measuring methodology."/>
<min value="0"/>
Expand All @@ -159,7 +166,7 @@
<isSummary value="true"/>
<binding>
<strength value="required"/>
<description value="How the Quantity should be understood and represented"/>
<description value="How the Quantity should be understood and represented."/>
<valueSetReference>
<reference value="http://hl7.org/fhir/ValueSet/quantity-comparator"/>
</valueSetReference>
Expand All @@ -176,8 +183,8 @@
<element>
<path value="Quantity.unit"/>
<short value="Unit representation"/>
<definition value="A human-readable form of the units."/>
<requirements value="There are many representations for units and in many contexts, particular representations are fixed and required. I.e. mcg for micrograms."/>
<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="0"/>
<max value="1"/>
<base>
Expand All @@ -191,7 +198,7 @@
<isSummary value="true"/>
<mapping>
<identity value="v2"/>
<map value="(see OBX.6 etc) / CQ.2"/>
<map value="(see OBX.6 etc.) / CQ.2"/>
</mapping>
<mapping>
<identity value="rim"/>
Expand All @@ -217,7 +224,7 @@
<isSummary value="true"/>
<mapping>
<identity value="v2"/>
<map value="(see OBX.6 etc) / CQ.2"/>
<map value="(see OBX.6 etc.) / CQ.2"/>
</mapping>
<mapping>
<identity value="rim"/>
Expand All @@ -227,9 +234,9 @@
<element>
<path value="Quantity.code"/>
<short value="Coded form of the unit"/>
<definition value="A computer processable form of the units in some unit representation system."/>
<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 units that is fixed across all forms. UCUM provides this for quantities, but SNOMED CT provides many units of interest."/>
<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="1"/>
<base>
Expand All @@ -243,7 +250,7 @@
<isSummary value="true"/>
<mapping>
<identity value="v2"/>
<map value="(see OBX.6 etc) / CQ.2"/>
<map value="(see OBX.6 etc.) / CQ.2"/>
</mapping>
<mapping>
<identity value="rim"/>
Expand All @@ -257,12 +264,15 @@
<name value="Age"/>
<short value="A duration (length of time) with a UCUM code"/>
<definition value="There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM. If value is present, it SHALL be positive."/>
<min value="1"/>
<max value="1"/>
<min value="0"/>
<max value="*"/>
<type>
<code value="Quantity"/>
</type>
<constraint>
<extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
<valueString value="(code or value.empty()) and (system.empty() or system = %ucum) and (value.empty() or value.contains(&#39;.&#39;).not())"/>
</extension>
<key value="age-1"/>
<severity value="error"/>
<human value="There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM. If value is present, it SHALL be positive."/>
Expand Down
Loading

0 comments on commit 547b529

Please sign in to comment.