Update FHIR R5 structures to 4.2.0 version (#1665)
* Work on upgrading core * Work on R5 updates * Work on core updates * Test fix * Update model version properties file for R5 * Bump core version * Test fixes * Add 4.2.0-SNAPSHOT version to versions page in docs
This commit is contained in:
parent
62b50f06ad
commit
1390ea3c06
|
@ -233,13 +233,21 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
|
|||
}
|
||||
|
||||
// check for the common case first - String value types
|
||||
if (value.getValue() instanceof String) {
|
||||
Object valueObj = value.getValue();
|
||||
if (valueObj instanceof String) {
|
||||
if (theChildName != null) {
|
||||
theEventWriter.write(theChildName, valueStr);
|
||||
} else {
|
||||
theEventWriter.write(valueStr);
|
||||
}
|
||||
break;
|
||||
} else if (valueObj instanceof Long) {
|
||||
if (theChildName != null) {
|
||||
theEventWriter.write(theChildName, (long)valueObj);
|
||||
} else {
|
||||
theEventWriter.write((long)valueObj);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (value instanceof IBaseIntegerDatatype) {
|
||||
|
|
|
@ -707,6 +707,12 @@ public class XmlParser extends BaseParser {
|
|||
theEventWriter.writeStartElement(prefix, se.getName().getLocalPart(), namespaceURI);
|
||||
theEventWriter.writeNamespace(prefix, namespaceURI);
|
||||
}
|
||||
for (Iterator<Attribute> iter= se.getAttributes(); iter.hasNext(); ) {
|
||||
Attribute next = iter.next();
|
||||
if ("lang".equals(next.getName().getLocalPart())) {
|
||||
theEventWriter.writeAttribute("", "", next.getName().getLocalPart(), next.getValue());
|
||||
}
|
||||
}
|
||||
firstElement = false;
|
||||
} else {
|
||||
if (isBlank(se.getName().getPrefix())) {
|
||||
|
|
|
@ -85,6 +85,8 @@ public class AttachmentUtil {
|
|||
BaseRuntimeChildDefinition entryChild = getChild(theContext, theAttachment, "size");
|
||||
if (theLength == null) {
|
||||
entryChild.getMutator().setValue(theAttachment, null);
|
||||
} else if (theContext.getVersion().getVersion().isEqualOrNewerThan(FhirVersionEnum.R5)){
|
||||
entryChild.getMutator().setValue(theAttachment, newPrimitive(theContext, "integer64", (long)theLength));
|
||||
} else {
|
||||
entryChild.getMutator().setValue(theAttachment, newPrimitive(theContext, "unsignedInt", theLength));
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package org.hl7.fhir.instance.model.api;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2019 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
|
||||
public interface IBaseLongDatatype extends IPrimitiveType<Integer> {
|
||||
|
||||
}
|
|
@ -64,6 +64,11 @@
|
|||
issue: "1649"
|
||||
type: "add"
|
||||
title: "Support for LOINC 2.67 file format changes has been added to the JPA Server LOINC uploader. Thanks to Dan Vreeman for reporting!"
|
||||
- item:
|
||||
issue: "1658"
|
||||
type: "fix"
|
||||
title: "When parsing HTML Narratives, the `lang` attribute was stripped from the outer DIV tag if present. Thanks to
|
||||
Sean McIlvenna for reporting!"
|
||||
- item:
|
||||
issue: "1655"
|
||||
type: "fix"
|
||||
|
|
|
@ -25,6 +25,16 @@ Note also that after the release of the FHIR DSTU2 specification, the FHIR
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>HAPI FHIR 4.2.0-SNAPSHOT</td>
|
||||
<td>JDK8</td>
|
||||
<td class="versions-table-cell-empty"></td>
|
||||
<td class="versions-table-cell-draft">1.0.2</td>
|
||||
<td class="versions-table-cell-release">1.4.0</td>
|
||||
<td class="versions-table-cell-draft">3.0.2</td>
|
||||
<td class="versions-table-cell-draft">4.0.1</td>
|
||||
<td class="versions-table-cell-release">4.2.0<span class="download-version-hash"><br/>e0f3f5cc2c</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>HAPI FHIR 4.1.0</td>
|
||||
<td>JDK8</td>
|
||||
|
|
|
@ -1356,7 +1356,7 @@ public class GenericJaxRsClientDstu3Test {
|
|||
.execute();
|
||||
fail();
|
||||
} catch (InvalidResponseException e) {
|
||||
assertThat(e.getMessage(), containsString("Unable to Parse HTML - node"));
|
||||
assertThat(e.getMessage(), containsString("Unable to Parse HTML"));
|
||||
}
|
||||
//@formatter:on
|
||||
}
|
||||
|
|
|
@ -20,29 +20,20 @@ package ca.uhn.fhir.jpa.dao.r5;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao;
|
||||
import ca.uhn.fhir.jpa.dao.IFhirResourceDao;
|
||||
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoSubscription;
|
||||
import ca.uhn.fhir.jpa.dao.data.ISubscriptionTableDao;
|
||||
import ca.uhn.fhir.jpa.entity.SubscriptionTable;
|
||||
import ca.uhn.fhir.jpa.model.cross.IBasePersistedResource;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
import ca.uhn.fhir.rest.api.EncodingEnum;
|
||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.r5.model.Subscription;
|
||||
import org.hl7.fhir.r5.model.codesystems.SubscriptionChannelType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Date;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
|
||||
public class FhirResourceDaoSubscriptionR5 extends BaseHapiFhirResourceDao<Subscription> implements IFhirResourceDaoSubscription<Subscription> {
|
||||
|
||||
@Autowired
|
||||
|
|
|
@ -38,15 +38,18 @@ import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
|||
import org.hl7.fhir.r5.hapi.ctx.DefaultProfileValidationSupport;
|
||||
import org.hl7.fhir.r5.hapi.ctx.HapiWorkerContext;
|
||||
import org.hl7.fhir.r5.hapi.ctx.IValidationSupport;
|
||||
import org.hl7.fhir.r5.model.*;
|
||||
import org.hl7.fhir.r5.model.CodeSystem;
|
||||
import org.hl7.fhir.r5.model.CodeableConcept;
|
||||
import org.hl7.fhir.r5.model.Coding;
|
||||
import org.hl7.fhir.r5.model.Enumerations;
|
||||
import org.hl7.fhir.r5.model.Enumerations.PublicationStatus;
|
||||
import org.hl7.fhir.r5.model.IntegerType;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent;
|
||||
import org.hl7.fhir.r5.model.ValueSet.FilterOperator;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||
import org.hl7.fhir.r5.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
|
@ -172,7 +175,7 @@ public class FhirResourceDaoValueSetR5 extends BaseHapiFhirResourceDao<ValueSet>
|
|||
ConceptSetComponent include = source.getCompose().addInclude();
|
||||
ConceptSetFilterComponent filter = include.addFilter();
|
||||
filter.setProperty("display");
|
||||
filter.setOp(FilterOperator.EQUAL);
|
||||
filter.setOp(Enumerations.FilterOperator.EQUAL);
|
||||
filter.setValue(theFilter);
|
||||
}
|
||||
|
||||
|
@ -207,7 +210,7 @@ public class FhirResourceDaoValueSetR5 extends BaseHapiFhirResourceDao<ValueSet>
|
|||
ConceptSetComponent include = source.getCompose().addInclude();
|
||||
ConceptSetFilterComponent filter = include.addFilter();
|
||||
filter.setProperty("display");
|
||||
filter.setOp(FilterOperator.EQUAL);
|
||||
filter.setOp(Enumerations.FilterOperator.EQUAL);
|
||||
filter.setValue(theFilter);
|
||||
}
|
||||
|
||||
|
@ -289,7 +292,7 @@ public class FhirResourceDaoValueSetR5 extends BaseHapiFhirResourceDao<ValueSet>
|
|||
private void addFilterIfPresent(String theFilter, ConceptSetComponent include) {
|
||||
if (ElementUtil.isEmpty(include.getConcept())) {
|
||||
if (isNotBlank(theFilter)) {
|
||||
include.addFilter().setProperty("display").setOp(FilterOperator.EQUAL).setValue(theFilter);
|
||||
include.addFilter().setProperty("display").setOp(Enumerations.FilterOperator.EQUAL).setValue(theFilter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
|
|||
obs.getCode().getCodingFirstRep().setSystem("http://loinc.org").setCode("CODE3").setDisplay("Display 3");
|
||||
obs.getCategoryFirstRep().addCoding().setSystem("http://terminology.hl7.org/CodeSystem/observation-category").setCode("FOO");
|
||||
oo = validateAndReturnOutcome(obs);
|
||||
assertEquals(encode(oo), "Unknown code: http://terminology.hl7.org/CodeSystem/observation-category / FOO", oo.getIssueFirstRep().getDiagnostics());
|
||||
assertEquals(encode(oo), "Unknown code[FOO] in system[http://terminology.hl7.org/CodeSystem/observation-category]", oo.getIssueFirstRep().getDiagnostics());
|
||||
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
|
|||
obs.getCode().getCodingFirstRep().setSystem("http://loinc.org").setCode("CODE3").setDisplay("Display 3");
|
||||
obs.getCategoryFirstRep().addCoding().setSystem("http://terminology.hl7.org/CodeSystem/observation-category").setCode("FOO");
|
||||
oo = validateAndReturnOutcome(obs);
|
||||
assertEquals(encode(oo), "Unknown code: http://terminology.hl7.org/CodeSystem/observation-category / FOO", oo.getIssueFirstRep().getDiagnostics());
|
||||
assertEquals(encode(oo), "Unknown code[FOO] in system[http://terminology.hl7.org/CodeSystem/observation-category]", oo.getIssueFirstRep().getDiagnostics());
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,13 @@ package ca.uhn.fhir.jpa.provider.r5;
|
|||
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.dao.IFhirResourceDao;
|
||||
import ca.uhn.fhir.jpa.dao.data.IResourceTableDao;
|
||||
import ca.uhn.fhir.jpa.entity.*;
|
||||
import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion;
|
||||
import ca.uhn.fhir.jpa.entity.TermConcept;
|
||||
import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink.RelationshipTypeEnum;
|
||||
import ca.uhn.fhir.jpa.entity.TermValueSet;
|
||||
import ca.uhn.fhir.jpa.entity.TermValueSetConcept;
|
||||
import ca.uhn.fhir.jpa.entity.TermValueSetConceptDesignation;
|
||||
import ca.uhn.fhir.jpa.entity.TermValueSetPreExpansionStatusEnum;
|
||||
import ca.uhn.fhir.jpa.model.cross.ResourcePersistentId;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
||||
import ca.uhn.fhir.jpa.term.api.ITermCodeSystemStorageSvc;
|
||||
|
@ -23,11 +28,10 @@ import org.apache.http.entity.ContentType;
|
|||
import org.apache.http.entity.StringEntity;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.r5.model.*;
|
||||
import org.hl7.fhir.r5.model.Bundle.HTTPVerb;
|
||||
import org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode;
|
||||
import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent;
|
||||
import org.hl7.fhir.r5.model.ValueSet.FilterOperator;
|
||||
import org.hl7.fhir.r5.model.codesystems.HttpVerb;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Test;
|
||||
|
@ -41,8 +45,16 @@ import java.util.Optional;
|
|||
|
||||
import static ca.uhn.fhir.jpa.dao.r4.FhirResourceDaoR4TerminologyTest.URL_MY_CODE_SYSTEM;
|
||||
import static ca.uhn.fhir.jpa.dao.r4.FhirResourceDaoR4TerminologyTest.URL_MY_VALUE_SET;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.containsStringIgnoringCase;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.stringContainsInOrder;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
|
||||
|
||||
|
@ -54,35 +66,35 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
|
|||
private Long myExtensionalVsIdOnResourceTable;
|
||||
private ValueSet myLocalVs;
|
||||
|
||||
private void loadAndPersistCodeSystemAndValueSet(HttpVerb theVerb) throws IOException {
|
||||
private void loadAndPersistCodeSystemAndValueSet(HTTPVerb theVerb) throws IOException {
|
||||
loadAndPersistCodeSystem(theVerb);
|
||||
loadAndPersistValueSet(theVerb);
|
||||
}
|
||||
|
||||
private void loadAndPersistCodeSystemAndValueSetWithDesignations(HttpVerb theVerb) throws IOException {
|
||||
private void loadAndPersistCodeSystemAndValueSetWithDesignations(HTTPVerb theVerb) throws IOException {
|
||||
loadAndPersistCodeSystemWithDesignations(theVerb);
|
||||
loadAndPersistValueSet(theVerb);
|
||||
}
|
||||
|
||||
private void loadAndPersistCodeSystemAndValueSetWithDesignationsAndExclude(HttpVerb theVerb) throws IOException {
|
||||
private void loadAndPersistCodeSystemAndValueSetWithDesignationsAndExclude(HTTPVerb theVerb) throws IOException {
|
||||
loadAndPersistCodeSystemWithDesignations(theVerb);
|
||||
loadAndPersistValueSetWithExclude(theVerb);
|
||||
}
|
||||
|
||||
private void loadAndPersistCodeSystem(HttpVerb theVerb) throws IOException {
|
||||
private void loadAndPersistCodeSystem(HTTPVerb theVerb) throws IOException {
|
||||
CodeSystem codeSystem = loadResourceFromClasspath(CodeSystem.class, "/extensional-case-3-cs.xml");
|
||||
codeSystem.setId("CodeSystem/cs");
|
||||
persistCodeSystem(codeSystem, theVerb);
|
||||
}
|
||||
|
||||
private void loadAndPersistCodeSystemWithDesignations(HttpVerb theVerb) throws IOException {
|
||||
private void loadAndPersistCodeSystemWithDesignations(HTTPVerb theVerb) throws IOException {
|
||||
CodeSystem codeSystem = loadResourceFromClasspath(CodeSystem.class, "/extensional-case-3-cs-with-designations.xml");
|
||||
codeSystem.setId("CodeSystem/cs");
|
||||
persistCodeSystem(codeSystem, theVerb);
|
||||
}
|
||||
|
||||
@SuppressWarnings("EnumSwitchStatementWhichMissesCases")
|
||||
private void persistCodeSystem(CodeSystem theCodeSystem, HttpVerb theVerb) {
|
||||
private void persistCodeSystem(CodeSystem theCodeSystem, HTTPVerb theVerb) {
|
||||
switch (theVerb) {
|
||||
case POST:
|
||||
new TransactionTemplate(myTxManager).execute(new TransactionCallbackWithoutResult() {
|
||||
|
@ -106,20 +118,20 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
|
|||
myExtensionalCsIdOnResourceTable = myCodeSystemDao.readEntity(myExtensionalCsId, null).getId();
|
||||
}
|
||||
|
||||
private void loadAndPersistValueSet(HttpVerb theVerb) throws IOException {
|
||||
private void loadAndPersistValueSet(HTTPVerb theVerb) throws IOException {
|
||||
ValueSet valueSet = loadResourceFromClasspath(ValueSet.class, "/extensional-case-3-vs.xml");
|
||||
valueSet.setId("ValueSet/vs");
|
||||
persistValueSet(valueSet, theVerb);
|
||||
}
|
||||
|
||||
private void loadAndPersistValueSetWithExclude(HttpVerb theVerb) throws IOException {
|
||||
private void loadAndPersistValueSetWithExclude(HTTPVerb theVerb) throws IOException {
|
||||
ValueSet valueSet = loadResourceFromClasspath(ValueSet.class, "/extensional-case-3-vs-with-exclude.xml");
|
||||
valueSet.setId("ValueSet/vs");
|
||||
persistValueSet(valueSet, theVerb);
|
||||
}
|
||||
|
||||
@SuppressWarnings("EnumSwitchStatementWhichMissesCases")
|
||||
private void persistValueSet(ValueSet theValueSet, HttpVerb theVerb) {
|
||||
private void persistValueSet(ValueSet theValueSet, HTTPVerb theVerb) {
|
||||
switch (theVerb) {
|
||||
case POST:
|
||||
new TransactionTemplate(myTxManager).execute(new TransactionCallbackWithoutResult() {
|
||||
|
@ -195,7 +207,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
|
|||
myLocalVs.setUrl(URL_MY_VALUE_SET);
|
||||
ConceptSetComponent include = myLocalVs.getCompose().addInclude();
|
||||
include.setSystem(codeSystem.getUrl());
|
||||
include.addFilter().setProperty("concept").setOp(FilterOperator.ISA).setValue("ParentA");
|
||||
include.addFilter().setProperty("concept").setOp(Enumerations.FilterOperator.ISA).setValue("ParentA");
|
||||
myLocalValueSetId = myValueSetDao.create(myLocalVs, mySrd).getId().toUnqualifiedVersionless();
|
||||
}
|
||||
|
||||
|
@ -212,13 +224,13 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
|
|||
myLocalVs.setUrl(URL_MY_VALUE_SET);
|
||||
ConceptSetComponent include = myLocalVs.getCompose().addInclude();
|
||||
include.setSystem(codeSystem.getUrl());
|
||||
include.addFilter().setProperty("concept").setOp(FilterOperator.ISA).setValue("childFOOOOOOO");
|
||||
include.addFilter().setProperty("concept").setOp(Enumerations.FilterOperator.ISA).setValue("childFOOOOOOO");
|
||||
myLocalValueSetId = myValueSetDao.create(myLocalVs, mySrd).getId().toUnqualifiedVersionless();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExpandById() throws Exception {
|
||||
loadAndPersistCodeSystemAndValueSet(HttpVerb.POST);
|
||||
loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST);
|
||||
|
||||
Parameters respParam = ourClient
|
||||
.operation()
|
||||
|
@ -250,7 +262,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
|
|||
public void testExpandByIdWithPreExpansion() throws Exception {
|
||||
myDaoConfig.setPreExpandValueSets(true);
|
||||
|
||||
loadAndPersistCodeSystemAndValueSet(HttpVerb.POST);
|
||||
loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST);
|
||||
myTermSvc.preExpandDeferredValueSetsToTerminologyTables();
|
||||
|
||||
Parameters respParam = ourClient
|
||||
|
@ -281,7 +293,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
|
|||
|
||||
@Test
|
||||
public void testExpandByIdWithFilter() throws Exception {
|
||||
loadAndPersistCodeSystemAndValueSet(HttpVerb.POST);
|
||||
loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST);
|
||||
|
||||
Parameters respParam = ourClient
|
||||
.operation()
|
||||
|
@ -302,7 +314,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
|
|||
public void testExpandByIdWithFilterWithPreExpansion() throws Exception {
|
||||
myDaoConfig.setPreExpandValueSets(true);
|
||||
|
||||
loadAndPersistCodeSystemAndValueSet(HttpVerb.POST);
|
||||
loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST);
|
||||
myTermSvc.preExpandDeferredValueSetsToTerminologyTables();
|
||||
|
||||
Parameters respParam = ourClient
|
||||
|
@ -322,7 +334,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
|
|||
|
||||
@Test
|
||||
public void testExpandByUrl() throws Exception {
|
||||
loadAndPersistCodeSystemAndValueSet(HttpVerb.POST);
|
||||
loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST);
|
||||
|
||||
Parameters respParam = ourClient
|
||||
.operation()
|
||||
|
@ -342,7 +354,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
|
|||
|
||||
@Test
|
||||
public void testExpandByUrlWithBogusUrl() throws Exception {
|
||||
loadAndPersistCodeSystemAndValueSet(HttpVerb.POST);
|
||||
loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST);
|
||||
|
||||
try {
|
||||
ourClient
|
||||
|
@ -361,7 +373,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
|
|||
public void testExpandByUrlWithPreExpansion() throws Exception {
|
||||
myDaoConfig.setPreExpandValueSets(true);
|
||||
|
||||
loadAndPersistCodeSystemAndValueSet(HttpVerb.POST);
|
||||
loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST);
|
||||
myTermSvc.preExpandDeferredValueSetsToTerminologyTables();
|
||||
|
||||
Parameters respParam = ourClient
|
||||
|
@ -384,7 +396,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
|
|||
public void testExpandByUrlWithPreExpansionAndBogusUrl() throws Exception {
|
||||
myDaoConfig.setPreExpandValueSets(true);
|
||||
|
||||
loadAndPersistCodeSystemAndValueSet(HttpVerb.POST);
|
||||
loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST);
|
||||
myTermSvc.preExpandDeferredValueSetsToTerminologyTables();
|
||||
|
||||
try {
|
||||
|
@ -402,7 +414,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
|
|||
|
||||
@Test
|
||||
public void testExpandByValueSet() throws IOException {
|
||||
loadAndPersistCodeSystem(HttpVerb.POST);
|
||||
loadAndPersistCodeSystem(HTTPVerb.POST);
|
||||
|
||||
ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-3-vs.xml");
|
||||
|
||||
|
@ -426,7 +438,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
|
|||
public void testExpandByValueSetWithPreExpansion() throws IOException {
|
||||
myDaoConfig.setPreExpandValueSets(true);
|
||||
|
||||
loadAndPersistCodeSystem(HttpVerb.POST);
|
||||
loadAndPersistCodeSystem(HTTPVerb.POST);
|
||||
myTermSvc.preExpandDeferredValueSetsToTerminologyTables();
|
||||
|
||||
ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-3-vs.xml");
|
||||
|
@ -491,7 +503,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
|
|||
|
||||
@Test
|
||||
public void testExpandInvalidParams() throws Exception {
|
||||
loadAndPersistCodeSystemAndValueSet(HttpVerb.POST);
|
||||
loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST);
|
||||
|
||||
try {
|
||||
ourClient
|
||||
|
@ -717,7 +729,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
|
|||
public void testUpdateValueSetTriggersAnotherPreExpansion() throws Exception {
|
||||
myDaoConfig.setPreExpandValueSets(true);
|
||||
|
||||
loadAndPersistCodeSystemAndValueSetWithDesignations(HttpVerb.POST);
|
||||
loadAndPersistCodeSystemAndValueSetWithDesignations(HTTPVerb.POST);
|
||||
|
||||
CodeSystem codeSystem = myCodeSystemDao.read(myExtensionalCsId);
|
||||
ourLog.info("CodeSystem:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(codeSystem));
|
||||
|
@ -732,7 +744,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
|
|||
|
||||
ValueSet updatedValueSet = valueSet;
|
||||
updatedValueSet.setName(valueSet.getName().concat(" - MODIFIED"));
|
||||
persistValueSet(updatedValueSet, HttpVerb.PUT);
|
||||
persistValueSet(updatedValueSet, HTTPVerb.PUT);
|
||||
updatedValueSet = myValueSetDao.read(myExtensionalVsId);
|
||||
ourLog.info("Updated ValueSet:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(updatedValueSet));
|
||||
|
||||
|
@ -746,7 +758,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
|
|||
public void testUpdateValueSetTriggersAnotherPreExpansionUsingTransactionBundle() throws Exception {
|
||||
myDaoConfig.setPreExpandValueSets(true);
|
||||
|
||||
loadAndPersistCodeSystemAndValueSetWithDesignations(HttpVerb.POST);
|
||||
loadAndPersistCodeSystemAndValueSetWithDesignations(Bundle.HTTPVerb.POST);
|
||||
|
||||
CodeSystem codeSystem = myCodeSystemDao.read(myExtensionalCsId);
|
||||
ourLog.info("CodeSystem:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(codeSystem));
|
||||
|
@ -877,7 +889,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
|
|||
|
||||
@Test
|
||||
public void testValidateCodeOperationByCodeAndSystemInstance() throws Exception {
|
||||
loadAndPersistCodeSystemAndValueSet(HttpVerb.POST);
|
||||
loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST);
|
||||
|
||||
Parameters respParam = ourClient
|
||||
.operation()
|
||||
|
@ -938,7 +950,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
|
|||
|
||||
@Test
|
||||
public void testValidateCodeOperationByCodeAndSystemType() throws Exception {
|
||||
loadAndPersistCodeSystemAndValueSet(HttpVerb.POST);
|
||||
loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST);
|
||||
|
||||
Parameters respParam = ourClient
|
||||
.operation()
|
||||
|
@ -996,7 +1008,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
|
|||
.addInclude()
|
||||
.setSystem("http://mycs")
|
||||
.addFilter()
|
||||
.setOp(FilterOperator.ISA)
|
||||
.setOp(Enumerations.FilterOperator.ISA)
|
||||
.setProperty("concept")
|
||||
.setValue("ParentA");
|
||||
IIdType vsId = myValueSetDao.create(vs).getId().toUnqualifiedVersionless();
|
||||
|
|
|
@ -3,6 +3,7 @@ package ca.uhn.fhir.jpa.subscription;
|
|||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.provider.r5.BaseResourceProviderR5Test;
|
||||
import ca.uhn.fhir.jpa.subscription.module.CanonicalSubscriptionChannelType;
|
||||
import ca.uhn.fhir.jpa.subscription.module.LinkedBlockingQueueSubscribableChannel;
|
||||
import ca.uhn.fhir.rest.annotation.Create;
|
||||
import ca.uhn.fhir.rest.annotation.ResourceParam;
|
||||
|
@ -21,9 +22,19 @@ import org.eclipse.jetty.servlet.ServletContextHandler;
|
|||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.r5.model.*;
|
||||
import org.hl7.fhir.r5.model.codesystems.SubscriptionChannelType;
|
||||
import org.junit.*;
|
||||
import org.hl7.fhir.r5.model.Bundle;
|
||||
import org.hl7.fhir.r5.model.CodeableConcept;
|
||||
import org.hl7.fhir.r5.model.Coding;
|
||||
import org.hl7.fhir.r5.model.Enumerations;
|
||||
import org.hl7.fhir.r5.model.IdType;
|
||||
import org.hl7.fhir.r5.model.Observation;
|
||||
import org.hl7.fhir.r5.model.Subscription;
|
||||
import org.hl7.fhir.r5.model.Topic;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
@ -131,8 +142,8 @@ public abstract class BaseSubscriptionsR5Test extends BaseResourceProviderR5Test
|
|||
|
||||
Subscription.SubscriptionChannelComponent channel = subscription.getChannel();
|
||||
channel.getType().addCoding()
|
||||
.setSystem(SubscriptionChannelType.RESTHOOK.getSystem())
|
||||
.setCode(SubscriptionChannelType.RESTHOOK.toCode());
|
||||
.setSystem(CanonicalSubscriptionChannelType.RESTHOOK.getSystem())
|
||||
.setCode(CanonicalSubscriptionChannelType.RESTHOOK.toCode());
|
||||
channel.getPayload().setContentType(thePayload);
|
||||
channel.setEndpoint(ourListenerServerBase);
|
||||
return subscription;
|
||||
|
@ -158,7 +169,7 @@ public abstract class BaseSubscriptionsR5Test extends BaseResourceProviderR5Test
|
|||
coding.setCode(code);
|
||||
coding.setSystem(system);
|
||||
|
||||
observation.setStatus(Observation.ObservationStatus.FINAL);
|
||||
observation.setStatus(Enumerations.ObservationStatus.FINAL);
|
||||
|
||||
IIdType id = myObservationDao.create(observation).getId();
|
||||
observation.setId(id);
|
||||
|
|
|
@ -131,7 +131,7 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
|
|||
Observation observation = new Observation();
|
||||
observation.getIdentifierFirstRep().setSystem("foo").setValue("1");
|
||||
observation.getCode().addCoding().setCode(code).setSystem("SNOMED-CT");
|
||||
observation.setStatus(Observation.ObservationStatus.FINAL);
|
||||
observation.setStatus(Enumerations.ObservationStatus.FINAL);
|
||||
observation.getSubject().setReference(patient.getId());
|
||||
bundle.addEntry().setResource(observation).getRequest().setMethod(Bundle.HTTPVerb.POST).setUrl("Observation");
|
||||
|
||||
|
@ -160,7 +160,7 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
|
|||
Observation observation = new Observation();
|
||||
observation.getIdentifierFirstRep().setSystem("foo").setValue("1");
|
||||
observation.getCode().addCoding().setCode(code).setSystem("SNOMED-CT");
|
||||
observation.setStatus(Observation.ObservationStatus.FINAL);
|
||||
observation.setStatus(Enumerations.ObservationStatus.FINAL);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.setType(Bundle.BundleType.TRANSACTION);
|
||||
bundle.addEntry().setResource(observation).getRequest().setMethod(Bundle.HTTPVerb.POST).setUrl("Observation");
|
||||
|
@ -187,7 +187,7 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
|
|||
observation.setId(obs.getId());
|
||||
observation.getIdentifierFirstRep().setSystem("foo").setValue("2");
|
||||
observation.getCode().addCoding().setCode(code).setSystem("SNOMED-CT");
|
||||
observation.setStatus(Observation.ObservationStatus.FINAL);
|
||||
observation.setStatus(Enumerations.ObservationStatus.FINAL);
|
||||
bundle = new Bundle();
|
||||
bundle.setType(Bundle.BundleType.TRANSACTION);
|
||||
bundle.addEntry().setResource(observation).getRequest().setMethod(Bundle.HTTPVerb.PUT).setUrl(obs.getIdElement().toUnqualifiedVersionless().getValue());
|
||||
|
@ -220,7 +220,7 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
|
|||
Observation observation = new Observation();
|
||||
observation.getIdentifierFirstRep().setSystem("foo").setValue("ID" + i);
|
||||
observation.getCode().addCoding().setCode(code).setSystem("SNOMED-CT");
|
||||
observation.setStatus(Observation.ObservationStatus.FINAL);
|
||||
observation.setStatus(Enumerations.ObservationStatus.FINAL);
|
||||
myObservationDao.create(observation);
|
||||
}
|
||||
|
||||
|
@ -669,7 +669,7 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
|
|||
CodeableConcept codeableConcept = new CodeableConcept()
|
||||
.addCoding(new Coding().setCode(code).setSystem("SNOMED-CT"));
|
||||
observation.setCode(codeableConcept);
|
||||
observation.setStatus(Observation.ObservationStatus.FINAL);
|
||||
observation.setStatus(Enumerations.ObservationStatus.FINAL);
|
||||
|
||||
Patient patient = new Patient();
|
||||
patient.addIdentifier().setSystem("foo").setValue("bar2");
|
||||
|
@ -848,7 +848,7 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
|
|||
@Test(expected = UnprocessableEntityException.class)
|
||||
public void testInvalidProvenanceParam() {
|
||||
String payload = "application/fhir+json";
|
||||
String criteriabad = "Provenance?activity=http://hl7.org/fhir/v3/DocumentCompletion%7CAU";
|
||||
String criteriabad = "Provenance?foo=http://hl7.org/fhir/v3/DocumentCompletion%7CAU";
|
||||
Subscription subscription = newSubscription(criteriabad, payload);
|
||||
ourClient.create().resource(subscription).execute();
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class AttachmentUtilTest {
|
|||
AttachmentUtil.setSize(ctx, attachment, 123);
|
||||
|
||||
org.hl7.fhir.r5.model.Communication communication = new org.hl7.fhir.r5.model.Communication();
|
||||
communication.addPayload().setContent((org.hl7.fhir.r5.model.Type) attachment);
|
||||
communication.addPayload().setContent((org.hl7.fhir.r5.model.DataType) attachment);
|
||||
String encoded = ctx.newJsonParser().encodeResourceToString(communication);
|
||||
assertEquals("{\"resourceType\":\"Communication\",\"payload\":[{\"contentAttachment\":{\"contentType\":\"text/plain\",\"data\":\"AAECAw==\",\"url\":\"http://foo\",\"size\":123}}]}", encoded);
|
||||
}
|
||||
|
|
|
@ -298,7 +298,7 @@ public class AnyListResource {
|
|||
|
||||
private boolean removeItemR5(String theReferenceId) {
|
||||
boolean removed = false;
|
||||
for (org.hl7.fhir.r5.model.ListResource.ListEntryComponent entry : getR5().getEntry()) {
|
||||
for (org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent entry : getR5().getEntry()) {
|
||||
if (theReferenceId.equals(entry.getItem().getReference()) && !entry.getDeleted()) {
|
||||
entry.setDeleted(true);
|
||||
removed = true;
|
||||
|
|
|
@ -163,6 +163,7 @@ public class SearchParamExtractorMegaTest {
|
|||
case "instant":
|
||||
leaf.setValueAsString("2019-10-10T11:11:11Z");
|
||||
break;
|
||||
case "integer64":
|
||||
case "integer":
|
||||
case "decimal":
|
||||
leaf.setValueAsString("1");
|
||||
|
|
|
@ -1693,25 +1693,6 @@ public class JsonParserDstu2_1Test {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* See #484
|
||||
*/
|
||||
@Test
|
||||
public void testParseNarrativeWithEmptyDiv() {
|
||||
String input = "{\"resourceType\":\"Basic\",\"id\":\"1\",\"text\":{\"status\":\"generated\",\"div\":\"<div/>\"}}";
|
||||
Basic basic = ourCtx.newJsonParser().parseResource(Basic.class, input);
|
||||
assertEquals(null, basic.getText().getDivAsString());
|
||||
|
||||
input = "{\"resourceType\":\"Basic\",\"id\":\"1\",\"text\":{\"status\":\"generated\",\"div\":\"<div></div>\"}}";
|
||||
basic = ourCtx.newJsonParser().parseResource(Basic.class, input);
|
||||
assertEquals(null, basic.getText().getDivAsString());
|
||||
|
||||
input = "{\"resourceType\":\"Basic\",\"id\":\"1\",\"text\":{\"status\":\"generated\",\"div\":\"<div> </div>\"}}";
|
||||
basic = ourCtx.newJsonParser().parseResource(Basic.class, input);
|
||||
assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\"> </div>", basic.getText().getDivAsString());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* See #163
|
||||
*/
|
||||
|
|
|
@ -30,7 +30,17 @@ public class XhtmlNodeTest {
|
|||
assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\">It’s January again</div>", new XhtmlNode().setValue(dt.getValue()).getValueAsString());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* See #1658
|
||||
*/
|
||||
@Test
|
||||
public void testLangAttributePreserved() {
|
||||
XhtmlNode dt = new XhtmlNode();
|
||||
dt.setValueAsString("<div xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en-US\">help i'm a bug</div>");
|
||||
assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en-US\">help i'm a bug</div>", dt.getValueAsString());
|
||||
assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en-US\">help i'm a bug</div>", new XhtmlNode().setValue(dt.getValue()).getValueAsString());
|
||||
}
|
||||
|
||||
/**
|
||||
* See #443
|
||||
*/
|
||||
|
|
|
@ -2187,11 +2187,11 @@ public class JsonParserDstu3Test {
|
|||
public void testParseNarrativeWithEmptyDiv() {
|
||||
String input = "{\"resourceType\":\"Basic\",\"id\":\"1\",\"text\":{\"status\":\"generated\",\"div\":\"<div/>\"}}";
|
||||
Basic basic = ourCtx.newJsonParser().parseResource(Basic.class, input);
|
||||
assertEquals(null, basic.getText().getDivAsString());
|
||||
assertEquals("<div/>", basic.getText().getDivAsString());
|
||||
|
||||
input = "{\"resourceType\":\"Basic\",\"id\":\"1\",\"text\":{\"status\":\"generated\",\"div\":\"<div></div>\"}}";
|
||||
basic = ourCtx.newJsonParser().parseResource(Basic.class, input);
|
||||
assertEquals(null, basic.getText().getDivAsString());
|
||||
assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\"/>", basic.getText().getDivAsString());
|
||||
|
||||
input = "{\"resourceType\":\"Basic\",\"id\":\"1\",\"text\":{\"status\":\"generated\",\"div\":\"<div> </div>\"}}";
|
||||
basic = ourCtx.newJsonParser().parseResource(Basic.class, input);
|
||||
|
@ -2199,6 +2199,18 @@ public class JsonParserDstu3Test {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* See #1658
|
||||
*/
|
||||
@Test
|
||||
public void testParseNarrativeWithLang() {
|
||||
String input = "{\"resourceType\":\"Basic\",\"id\":\"1\",\"text\":{\"status\":\"generated\",\"div\":\"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\" lang=\\\"en-US\\\">foo</div>\"}}";
|
||||
Basic basic = ourCtx.newJsonParser().parseResource(Basic.class, input);
|
||||
assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en-US\">foo</div>", basic.getText().getDivAsString());
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* See #163
|
||||
*/
|
||||
|
|
|
@ -1,21 +1,26 @@
|
|||
package ca.uhn.fhir.parser;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.stringContainsInOrder;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import ca.uhn.fhir.test.BaseTest;
|
||||
import org.hl7.fhir.r4.model.Bundle;
|
||||
import org.hl7.fhir.r4.model.Composition;
|
||||
import org.hl7.fhir.r4.model.MessageHeader;
|
||||
import org.hl7.fhir.r4.model.Narrative;
|
||||
import org.hl7.fhir.r4.model.Observation;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
||||
public class XmlParserR4Test {
|
||||
import java.io.IOException;
|
||||
|
||||
public class XmlParserR4Test extends BaseTest {
|
||||
private static final Logger ourLog = LoggerFactory.getLogger(XmlParserR4Test.class);
|
||||
private static FhirContext ourCtx = FhirContext.forR4();
|
||||
|
||||
|
@ -74,5 +79,17 @@ public class XmlParserR4Test {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* See #1658
|
||||
*/
|
||||
@Test
|
||||
public void testNarrativeLangAttributePreserved() throws IOException {
|
||||
Observation obs = loadResource(ourCtx, Observation.class, "/resource-with-lang-in-narrative.xml");
|
||||
String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(obs);
|
||||
assertThat(encoded, containsString("xmlns=\"http://www.w3.org/1999/xhtml\""));
|
||||
assertThat(encoded, containsString("lang=\"en-US\""));
|
||||
ourLog.info(encoded);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><Observation xmlns="http://hl7.org/fhir">
|
||||
<id value="f001"/><!-- urn:oid:2.16.840.1.113883.4.642.1.7 --><!-- 2.16.840.1.113883.4.642.1.118 -->
|
||||
<text>
|
||||
<status value="generated"/>
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" lang="en-US"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: f001</p><p><b>identifier</b>: 6323 (OFFICIAL)</p><p><b>status</b>: final</p><p><b>code</b>: Glucose [Moles/volume] in Blood <span>(Details : {LOINC code '15074-8' = 'Glucose [Moles/volume] in Blood', given as 'Glucose [Moles/volume] in Blood'})</span></p><p><b>subject</b>: <a>P. van de Heuvel</a></p><p><b>effective</b>: 02/04/2013 9:30:10 AM --> (ongoing)</p><p><b>issued</b>: 03/04/2013 3:30:10 PM</p><p><b>performer</b>: <a>A. Langeveld</a></p><p><b>value</b>: 6.3 mmol/l<span> (Details: UCUM code mmol/L = 'mmol/L')</span></p><p><b>interpretation</b>: High <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'H' = 'High', given as 'High'})</span></p><h3>ReferenceRanges</h3><table><tr><td>-</td><td><b>Low</b></td><td><b>High</b></td></tr><tr><td>*</td><td>3.1 mmol/l<span> (Details: UCUM code mmol/L = 'mmol/L')</span></td><td>6.2 mmol/l<span> (Details: UCUM code mmol/L = 'mmol/L')</span></td></tr></table></div></text><identifier>
|
||||
<use value="official"/>
|
||||
<system value="http://www.bmc.nl/zorgportal/identifiers/observations"/>
|
||||
<value value="6323"/>
|
||||
</identifier>
|
||||
<status value="final"/>
|
||||
<code>
|
||||
<coding>
|
||||
<system value="http://loinc.org"/>
|
||||
<code value="15074-8"/>
|
||||
<display value="Glucose [Moles/volume] in Blood"/>
|
||||
</coding>
|
||||
</code>
|
||||
<effectivePeriod>
|
||||
<start value="2013-04-02T09:30:10+01:00"/>
|
||||
</effectivePeriod>
|
||||
<issued value="2013-04-03T15:30:10+01:00"/>
|
||||
<valueQuantity>
|
||||
<value value="6.3"/>
|
||||
<unit value="mmol/l"/>
|
||||
<system value="http://unitsofmeasure.org"/>
|
||||
<code value="mmol/L"/>
|
||||
</valueQuantity>
|
||||
<interpretation>
|
||||
<coding>
|
||||
<system value="http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation"/>
|
||||
<code value="H"/>
|
||||
<display value="High"/>
|
||||
</coding>
|
||||
</interpretation>
|
||||
<referenceRange>
|
||||
<low>
|
||||
<value value="3.1"/>
|
||||
<unit value="mmol/l"/>
|
||||
<system value="http://unitsofmeasure.org"/>
|
||||
<code value="mmol/L"/>
|
||||
</low>
|
||||
<high>
|
||||
<value value="6.2"/>
|
||||
<unit value="mmol/l"/>
|
||||
<system value="http://unitsofmeasure.org"/>
|
||||
<code value="mmol/L"/>
|
||||
</high>
|
||||
</referenceRange>
|
||||
</Observation>
|
|
@ -314,7 +314,7 @@ public class DefaultProfileValidationSupport implements IValidationSupport {
|
|||
.filter(t -> (Constants.codeSystemNotNeeded(theCodeSystem) || t.getSystem().equals(theCodeSystem)) && t.getCode().equals(theCode))
|
||||
.findFirst();
|
||||
if (haveMatch.isPresent()) {
|
||||
return new CodeValidationResult(new ConceptDefinitionComponent(new CodeType(theCode)));
|
||||
return new CodeValidationResult(new ConceptDefinitionComponent(theCode));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -24,11 +24,15 @@ import org.hl7.fhir.r5.terminologies.ValueSetExpander;
|
|||
import org.hl7.fhir.r5.terminologies.ValueSetExpanderFactory;
|
||||
import org.hl7.fhir.r5.terminologies.ValueSetExpanderSimple;
|
||||
import org.hl7.fhir.r5.utils.IResourceValidator;
|
||||
import org.hl7.fhir.utilities.TerminologyServiceOptions;
|
||||
import org.hl7.fhir.utilities.TranslationServices;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
|
@ -144,15 +148,9 @@ public final class HapiWorkerContext implements IWorkerContext, ValueSetExpander
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> typeTails() {
|
||||
return new HashSet<>(Arrays.asList("Integer", "UnsignedInt", "PositiveInt", "Decimal", "DateTime", "Date", "Time", "Instant", "String", "Uri", "Oid", "Uuid", "Id", "Boolean", "Code",
|
||||
"Markdown", "Base64Binary", "Coding", "CodeableConcept", "Attachment", "Identifier", "Quantity", "SampledData", "Range", "Period", "Ratio", "HumanName", "Address", "ContactPoint",
|
||||
"Timing", "Reference", "Annotation", "Signature", "Meta"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, CodeableConcept theCode, ValueSet theVs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, CodeableConcept theCode, ValueSet theVs) {
|
||||
for (Coding next : theCode.getCoding()) {
|
||||
ValidationResult retVal = validateCode(theOptions, next, theVs);
|
||||
if (retVal.isOk()) {
|
||||
|
@ -164,7 +162,7 @@ public final class HapiWorkerContext implements IWorkerContext, ValueSetExpander
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, Coding theCode, ValueSet theVs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, Coding theCode, ValueSet theVs) {
|
||||
String system = theCode.getSystem();
|
||||
String code = theCode.getCode();
|
||||
String display = theCode.getDisplay();
|
||||
|
@ -172,7 +170,7 @@ public final class HapiWorkerContext implements IWorkerContext, ValueSetExpander
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String theSystem, String theCode, String theDisplay) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, String theSystem, String theCode, String theDisplay) {
|
||||
IContextValidationSupport.CodeValidationResult result = myValidationSupport.validateCode(myCtx, theSystem, theCode, theDisplay, null);
|
||||
if (result == null) {
|
||||
return null;
|
||||
|
@ -181,12 +179,7 @@ public final class HapiWorkerContext implements IWorkerContext, ValueSetExpander
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String theSystem, String theCode, String theDisplay, ConceptSetComponent theVsi) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String theSystem, String theCode, String theDisplay, ValueSet theVs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, String theSystem, String theCode, String theDisplay, ValueSet theVs) {
|
||||
|
||||
/*
|
||||
* The following valueset is a special case, since the BCP codesystem is very difficult to expand
|
||||
|
@ -227,13 +220,13 @@ public final class HapiWorkerContext implements IWorkerContext, ValueSetExpander
|
|||
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String code, ValueSet vs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, String code, ValueSet vs) {
|
||||
return validateCode(theOptions, null, code, null, vs);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CoverageIgnore
|
||||
public List<MetadataResource> allConformanceResources() {
|
||||
public List<CanonicalResource> allConformanceResources() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -242,6 +235,11 @@ public final class HapiWorkerContext implements IWorkerContext, ValueSetExpander
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateSnapshot(StructureDefinition mr, boolean ifLogical) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Parameters getExpansionParameters() {
|
||||
return myExpansionProfile;
|
||||
|
@ -400,4 +398,9 @@ public final class HapiWorkerContext implements IWorkerContext, ValueSetExpander
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, byte[]> getBinaries() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.hl7.fhir.r5.hapi.rest.server;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.context.RuntimeSearchParam;
|
||||
|
@ -14,31 +15,51 @@ import ca.uhn.fhir.rest.server.IServerConformanceProvider;
|
|||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import ca.uhn.fhir.rest.server.RestfulServerConfiguration;
|
||||
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
||||
import ca.uhn.fhir.rest.server.method.*;
|
||||
import ca.uhn.fhir.rest.server.method.SearchParameter;
|
||||
import ca.uhn.fhir.rest.server.method.BaseMethodBinding;
|
||||
import ca.uhn.fhir.rest.server.method.IParameter;
|
||||
import ca.uhn.fhir.rest.server.method.OperationMethodBinding;
|
||||
import ca.uhn.fhir.rest.server.method.OperationMethodBinding.ReturnType;
|
||||
import ca.uhn.fhir.rest.server.method.OperationParameter;
|
||||
import ca.uhn.fhir.rest.server.method.SearchMethodBinding;
|
||||
import ca.uhn.fhir.rest.server.method.SearchParameter;
|
||||
import ca.uhn.fhir.rest.server.util.BaseServerCapabilityStatementProvider;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
import org.hl7.fhir.r5.model.*;
|
||||
import org.hl7.fhir.r5.model.CapabilityStatement.*;
|
||||
import org.hl7.fhir.r5.model.CapabilityStatement;
|
||||
import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent;
|
||||
import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent;
|
||||
import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent;
|
||||
import org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus;
|
||||
import org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent;
|
||||
import org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction;
|
||||
import org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction;
|
||||
import org.hl7.fhir.r5.model.DateTimeType;
|
||||
import org.hl7.fhir.r5.model.Enumerations;
|
||||
import org.hl7.fhir.r5.model.Enumerations.PublicationStatus;
|
||||
import org.hl7.fhir.r5.model.IdType;
|
||||
import org.hl7.fhir.r5.model.OperationDefinition;
|
||||
import org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent;
|
||||
import org.hl7.fhir.r5.model.OperationDefinition.OperationKind;
|
||||
import org.hl7.fhir.r5.model.OperationDefinition.OperationParameterUse;
|
||||
import org.hl7.fhir.r5.model.ResourceType;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR Structures - DSTU2 (FHIR v1.0.0)
|
||||
|
@ -160,7 +181,7 @@ public class ServerCapabilityStatementProvider extends BaseServerCapabilityState
|
|||
.setUrl(serverBase)
|
||||
.setDescription(configuration.getImplementationDescription());
|
||||
|
||||
retVal.setKind(CapabilityStatementKind.INSTANCE);
|
||||
retVal.setKind(Enumerations.CapabilityStatementKind.INSTANCE);
|
||||
retVal.getSoftware().setName(configuration.getServerName());
|
||||
retVal.getSoftware().setVersion(configuration.getServerVersion());
|
||||
retVal.addFormat(Constants.CT_FHIR_XML_NEW);
|
||||
|
@ -168,7 +189,7 @@ public class ServerCapabilityStatementProvider extends BaseServerCapabilityState
|
|||
retVal.setStatus(PublicationStatus.ACTIVE);
|
||||
|
||||
CapabilityStatementRestComponent rest = retVal.addRest();
|
||||
rest.setMode(RestfulCapabilityMode.SERVER);
|
||||
rest.setMode(Enumerations.RestfulCapabilityMode.SERVER);
|
||||
|
||||
Set<SystemRestfulInteraction> systemOps = new HashSet<>();
|
||||
Set<String> operationNames = new HashSet<>();
|
||||
|
@ -442,8 +463,8 @@ public class ServerCapabilityStatementProvider extends BaseServerCapabilityState
|
|||
continue;
|
||||
}
|
||||
OperationDefinitionParameterComponent param = op.addParameter();
|
||||
param.setUse(OperationParameterUse.IN);
|
||||
param.setType("string");
|
||||
param.setUse(Enumerations.OperationParameterUse.IN);
|
||||
param.setType(Enumerations.FHIRAllTypes.STRING);
|
||||
param.getSearchTypeElement().setValueAsString(nextParam.getParamType().getCode());
|
||||
param.setMin(nextParam.isRequired() ? 1 : 0);
|
||||
param.setMax("1");
|
||||
|
@ -511,9 +532,9 @@ public class ServerCapabilityStatementProvider extends BaseServerCapabilityState
|
|||
if (!inParams.add(nextParam.getName())) {
|
||||
continue;
|
||||
}
|
||||
param.setUse(OperationParameterUse.IN);
|
||||
param.setUse(Enumerations.OperationParameterUse.IN);
|
||||
if (nextParam.getParamType() != null) {
|
||||
param.setType(nextParam.getParamType());
|
||||
param.setType(Enumerations.FHIRAllTypes.fromCode(nextParam.getParamType()));
|
||||
}
|
||||
if (nextParam.getSearchParamType() != null) {
|
||||
param.getSearchTypeElement().setValueAsString(nextParam.getSearchParamType());
|
||||
|
@ -529,9 +550,9 @@ public class ServerCapabilityStatementProvider extends BaseServerCapabilityState
|
|||
continue;
|
||||
}
|
||||
OperationDefinitionParameterComponent param = op.addParameter();
|
||||
param.setUse(OperationParameterUse.OUT);
|
||||
param.setUse(Enumerations.OperationParameterUse.OUT);
|
||||
if (nextParam.getType() != null) {
|
||||
param.setType(nextParam.getType());
|
||||
param.setType(Enumerations.FHIRAllTypes.fromCode(nextParam.getType()));
|
||||
}
|
||||
param.setMin(nextParam.getMin());
|
||||
param.setMax(nextParam.getMax() == -1 ? "*" : Integer.toString(nextParam.getMax()));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# This file contains version definitions
|
||||
# Generated: 2019-10-26T18:45:40.876-04:00
|
||||
# Generated: 2020-01-12T11:10:06.793+08:00
|
||||
|
||||
resource.Account=org.hl7.fhir.r5.model.Account
|
||||
resource.ActivityDefinition=org.hl7.fhir.r5.model.ActivityDefinition
|
||||
|
@ -148,14 +148,16 @@ datatype.Address=org.hl7.fhir.r5.model.Address
|
|||
datatype.Age=org.hl7.fhir.r5.model.Age
|
||||
datatype.Annotation=org.hl7.fhir.r5.model.Annotation
|
||||
datatype.Attachment=org.hl7.fhir.r5.model.Attachment
|
||||
datatype.BackboneElement=org.hl7.fhir.r5.model.BackboneType
|
||||
datatype.BackboneType=org.hl7.fhir.r5.model.BackboneType
|
||||
datatype.CodeableConcept=org.hl7.fhir.r5.model.CodeableConcept
|
||||
datatype.CodeableReference=org.hl7.fhir.r5.model.CodeableReference
|
||||
datatype.Coding=org.hl7.fhir.r5.model.Coding
|
||||
datatype.ContactDetail=org.hl7.fhir.r5.model.ContactDetail
|
||||
datatype.ContactPoint=org.hl7.fhir.r5.model.ContactPoint
|
||||
datatype.Contributor=org.hl7.fhir.r5.model.Contributor
|
||||
datatype.Count=org.hl7.fhir.r5.model.Count
|
||||
datatype.DataRequirement=org.hl7.fhir.r5.model.DataRequirement
|
||||
datatype.DataType=org.hl7.fhir.r5.model.DataType
|
||||
datatype.Distance=org.hl7.fhir.r5.model.Distance
|
||||
datatype.Dosage=org.hl7.fhir.r5.model.Dosage
|
||||
datatype.Duration=org.hl7.fhir.r5.model.Duration
|
||||
|
@ -199,6 +201,7 @@ datatype.decimal=org.hl7.fhir.r5.model.DecimalType
|
|||
datatype.id=org.hl7.fhir.r5.model.IdType
|
||||
datatype.instant=org.hl7.fhir.r5.model.InstantType
|
||||
datatype.integer=org.hl7.fhir.r5.model.IntegerType
|
||||
datatype.integer64=org.hl7.fhir.r5.model.Integer64Type
|
||||
datatype.markdown=org.hl7.fhir.r5.model.MarkdownType
|
||||
datatype.oid=org.hl7.fhir.r5.model.OidType
|
||||
datatype.positiveInt=org.hl7.fhir.r5.model.PositiveIntType
|
||||
|
@ -207,4 +210,5 @@ datatype.time=org.hl7.fhir.r5.model.TimeType
|
|||
datatype.unsignedInt=org.hl7.fhir.r5.model.UnsignedIntType
|
||||
datatype.uri=org.hl7.fhir.r5.model.UriType
|
||||
datatype.url=org.hl7.fhir.r5.model.UrlType
|
||||
datatype.uuid=org.hl7.fhir.r5.model.UuidType
|
||||
datatype.xhtml=org.hl7.fhir.utilities.xhtml.XhtmlNode
|
||||
|
|
|
@ -3,13 +3,19 @@ package ca.uhn.fhir.rest.server;
|
|||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||
import ca.uhn.fhir.rest.annotation.*;
|
||||
import ca.uhn.fhir.rest.api.MethodOutcome;
|
||||
import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
|
||||
import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.fhir.rest.param.*;
|
||||
import ca.uhn.fhir.rest.param.DateRangeParam;
|
||||
import ca.uhn.fhir.rest.param.QuantityParam;
|
||||
import ca.uhn.fhir.rest.param.ReferenceAndListParam;
|
||||
import ca.uhn.fhir.rest.param.StringParam;
|
||||
import ca.uhn.fhir.rest.param.TokenOrListParam;
|
||||
import ca.uhn.fhir.rest.param.TokenParam;
|
||||
import ca.uhn.fhir.rest.server.method.BaseMethodBinding;
|
||||
import ca.uhn.fhir.rest.server.method.IParameter;
|
||||
import ca.uhn.fhir.rest.server.method.SearchMethodBinding;
|
||||
|
@ -21,26 +27,41 @@ import com.google.common.collect.Lists;
|
|||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.r5.hapi.rest.server.ServerCapabilityStatementProvider;
|
||||
import org.hl7.fhir.r5.model.*;
|
||||
import org.hl7.fhir.r5.model.CapabilityStatement.*;
|
||||
import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent;
|
||||
import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent;
|
||||
import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent;
|
||||
import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent;
|
||||
import org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus;
|
||||
import org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction;
|
||||
import org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction;
|
||||
import org.hl7.fhir.r5.model.Enumerations.PublicationStatus;
|
||||
import org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent;
|
||||
import org.hl7.fhir.r5.model.OperationDefinition.OperationKind;
|
||||
import org.hl7.fhir.r5.model.OperationDefinition.OperationParameterUse;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.empty;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
||||
|
||||
public class ServerCapabilityStatementProviderR5Test {
|
||||
|
||||
private static FhirContext ourCtx;
|
||||
|
@ -265,9 +286,9 @@ public class ServerCapabilityStatementProviderR5Test {
|
|||
assertThat(types, containsInAnyOrder("Patient"));
|
||||
assertEquals(2, opDef.getParameter().size());
|
||||
assertEquals("someOpParam1", opDef.getParameter().get(0).getName());
|
||||
assertEquals("date", opDef.getParameter().get(0).getType());
|
||||
assertEquals("date", opDef.getParameter().get(0).getType().toCode());
|
||||
assertEquals("someOpParam2", opDef.getParameter().get(1).getName());
|
||||
assertEquals("Patient", opDef.getParameter().get(1).getType());
|
||||
assertEquals("Patient", opDef.getParameter().get(1).getType().toCode());
|
||||
}
|
||||
{
|
||||
OperationDefinition opDef = sc.readOperationDefinition(new IdType("OperationDefinition/Encounter-i-someOp"), createRequestDetails(rs));
|
||||
|
@ -280,9 +301,9 @@ public class ServerCapabilityStatementProviderR5Test {
|
|||
assertThat(types, containsInAnyOrder("Encounter"));
|
||||
assertEquals(2, opDef.getParameter().size());
|
||||
assertEquals("someOpParam1", opDef.getParameter().get(0).getName());
|
||||
assertEquals("date", opDef.getParameter().get(0).getType());
|
||||
assertEquals("date", opDef.getParameter().get(0).getType().toCode());
|
||||
assertEquals("someOpParam2", opDef.getParameter().get(1).getName());
|
||||
assertEquals("Encounter", opDef.getParameter().get(1).getType());
|
||||
assertEquals("Encounter", opDef.getParameter().get(1).getType().toCode());
|
||||
}
|
||||
{
|
||||
OperationDefinition opDef = sc.readOperationDefinition(new IdType("OperationDefinition/Patient-i-validate"), createRequestDetails(rs));
|
||||
|
@ -295,7 +316,7 @@ public class ServerCapabilityStatementProviderR5Test {
|
|||
assertThat(types, containsInAnyOrder("Patient"));
|
||||
assertEquals(1, opDef.getParameter().size());
|
||||
assertEquals("resource", opDef.getParameter().get(0).getName());
|
||||
assertEquals("Patient", opDef.getParameter().get(0).getType());
|
||||
assertEquals("Patient", opDef.getParameter().get(0).getType().toCode());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -672,11 +693,11 @@ public class ServerCapabilityStatementProviderR5Test {
|
|||
assertThat(parameters.size(), is(1));
|
||||
OperationDefinitionParameterComponent param = parameters.get(0);
|
||||
assertThat(param.getName(), is(NamedQueryPlainProvider.SP_QUANTITY));
|
||||
assertThat(param.getType(), is("string"));
|
||||
assertThat(param.getType().toCode(), is("string"));
|
||||
assertThat(param.getSearchTypeElement().asStringValue(), is(RestSearchParameterTypeEnum.QUANTITY.getCode()));
|
||||
assertThat(param.getMin(), is(1));
|
||||
assertThat(param.getMax(), is("1"));
|
||||
assertThat(param.getUse(), is(OperationParameterUse.IN));
|
||||
assertThat(param.getUse(), is(Enumerations.OperationParameterUse.IN));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -710,11 +731,11 @@ public class ServerCapabilityStatementProviderR5Test {
|
|||
assertThat(parameters.size(), is(1));
|
||||
OperationDefinitionParameterComponent param = parameters.get(0);
|
||||
assertThat(param.getName(), is(NamedQueryResourceProvider.SP_PARAM));
|
||||
assertThat(param.getType(), is("string"));
|
||||
assertThat(param.getType().toCode(), is("string"));
|
||||
assertThat(param.getSearchTypeElement().asStringValue(), is(RestSearchParameterTypeEnum.STRING.getCode()));
|
||||
assertThat(param.getMin(), is(0));
|
||||
assertThat(param.getMax(), is("1"));
|
||||
assertThat(param.getUse(), is(OperationParameterUse.IN));
|
||||
assertThat(param.getUse(), is(Enumerations.OperationParameterUse.IN));
|
||||
|
||||
CapabilityStatementRestResourceComponent patientResource = restComponent.getResource().stream()
|
||||
.filter(r -> patientResourceName.equals(r.getType()))
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -18,11 +18,12 @@ import org.apache.commons.lang3.time.DateUtils;
|
|||
import org.fhir.ucum.UcumService;
|
||||
import org.hl7.fhir.common.hapi.validation.ValidatorWrapper;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_14_50;
|
||||
import org.hl7.fhir.dstu2016may.terminologies.ValueSetExpander;
|
||||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
import org.hl7.fhir.exceptions.TerminologyServiceException;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.formats.IParser;
|
||||
import org.hl7.fhir.r5.formats.ParserType;
|
||||
import org.hl7.fhir.r5.model.CanonicalResource;
|
||||
import org.hl7.fhir.r5.utils.INarrativeGenerator;
|
||||
import org.hl7.fhir.r5.utils.IResourceValidator;
|
||||
import org.hl7.fhir.r5.model.Resource;
|
||||
|
@ -31,6 +32,7 @@ import org.hl7.fhir.exceptions.FHIRException;
|
|||
import org.hl7.fhir.utilities.TerminologyServiceOptions;
|
||||
import org.hl7.fhir.utilities.TranslationServices;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
import org.w3c.dom.*;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
|
@ -326,17 +328,27 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IValid
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<org.hl7.fhir.r5.model.MetadataResource> allConformanceResources() {
|
||||
public List<CanonicalResource> allConformanceResources() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateSnapshot(org.hl7.fhir.r5.model.StructureDefinition theStructureDefinition) throws DefinitionException, FHIRException {
|
||||
// nothing yet
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLinkForUrl(String corePath, String url) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateSnapshot(org.hl7.fhir.r5.model.StructureDefinition p) throws FHIRException {
|
||||
public Map<String, byte[]> getBinaries() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateSnapshot(org.hl7.fhir.r5.model.StructureDefinition p, boolean theb) throws FHIRException {
|
||||
// nothing yet
|
||||
}
|
||||
|
||||
|
@ -469,7 +481,7 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IValid
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions options, String system, String code, String display) {
|
||||
public ValidationResult validateCode(ValidationOptions options, String system, String code, String display) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -646,14 +658,9 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IValid
|
|||
return myWrap.supportsSystem(system);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> typeTails() {
|
||||
return myWrap.typeTails();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String system, String code, String display, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, String system, String code, String display, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
ValueSet convertedVs = null;
|
||||
|
||||
try {
|
||||
|
@ -669,7 +676,7 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IValid
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, String code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
ValueSet convertedVs = null;
|
||||
try {
|
||||
if (vs != null) {
|
||||
|
@ -684,7 +691,7 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IValid
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, org.hl7.fhir.r5.model.Coding code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, org.hl7.fhir.r5.model.Coding code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
Coding convertedCode = null;
|
||||
ValueSet convertedVs = null;
|
||||
|
||||
|
@ -704,7 +711,7 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IValid
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, org.hl7.fhir.r5.model.CodeableConcept code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, org.hl7.fhir.r5.model.CodeableConcept code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
CodeableConcept convertedCode = null;
|
||||
ValueSet convertedVs = null;
|
||||
|
||||
|
@ -723,21 +730,6 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IValid
|
|||
return convertValidationResult(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String system, String code, String display, org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent vsi) {
|
||||
ValueSet.ConceptSetComponent conceptSetComponent = null;
|
||||
if (vsi != null) {
|
||||
try {
|
||||
conceptSetComponent = VersionConvertor_14_50.convertConceptSetComponent(vsi);
|
||||
} catch (FHIRException e) {
|
||||
throw new InternalErrorException(e);
|
||||
}
|
||||
}
|
||||
|
||||
org.hl7.fhir.dstu2016may.utils.IWorkerContext.ValidationResult result = myWrap.validateCode(system, code, display, conceptSetComponent);
|
||||
return convertValidationResult(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class ResourceKey {
|
||||
|
|
|
@ -5,7 +5,6 @@ import ca.uhn.fhir.rest.api.Constants;
|
|||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
import ca.uhn.fhir.validation.IInstanceValidatorModule;
|
||||
import ca.uhn.fhir.validation.IValidationContext;
|
||||
import ca.uhn.fhir.validation.IValidatorModule;
|
||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||
import com.github.benmanes.caffeine.cache.LoadingCache;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
@ -18,20 +17,28 @@ import org.hl7.fhir.convertors.VersionConvertor_30_50;
|
|||
import org.hl7.fhir.dstu3.hapi.ctx.DefaultProfileValidationSupport;
|
||||
import org.hl7.fhir.dstu3.hapi.ctx.HapiWorkerContext;
|
||||
import org.hl7.fhir.dstu3.hapi.ctx.IValidationSupport;
|
||||
import org.hl7.fhir.dstu3.model.*;
|
||||
import org.hl7.fhir.dstu3.model.CodeSystem;
|
||||
import org.hl7.fhir.dstu3.model.CodeableConcept;
|
||||
import org.hl7.fhir.dstu3.model.Coding;
|
||||
import org.hl7.fhir.dstu3.model.ImplementationGuide;
|
||||
import org.hl7.fhir.dstu3.model.Questionnaire;
|
||||
import org.hl7.fhir.dstu3.model.Resource;
|
||||
import org.hl7.fhir.dstu3.model.StructureDefinition;
|
||||
import org.hl7.fhir.dstu3.model.ValueSet;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.exceptions.TerminologyServiceException;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.formats.IParser;
|
||||
import org.hl7.fhir.r5.formats.ParserType;
|
||||
import org.hl7.fhir.r5.model.CanonicalResource;
|
||||
import org.hl7.fhir.r5.terminologies.ValueSetExpander;
|
||||
import org.hl7.fhir.r5.utils.INarrativeGenerator;
|
||||
import org.hl7.fhir.r5.utils.IResourceValidator;
|
||||
import org.hl7.fhir.r5.utils.IResourceValidator.BestPracticeWarningLevel;
|
||||
import org.hl7.fhir.utilities.TerminologyServiceOptions;
|
||||
import org.hl7.fhir.utilities.TranslationServices;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
@ -40,7 +47,13 @@ import javax.annotation.Nonnull;
|
|||
import javax.annotation.Nullable;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@SuppressWarnings({"PackageAccessibility", "Duplicates"})
|
||||
|
@ -331,7 +344,7 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<org.hl7.fhir.r5.model.MetadataResource> allConformanceResources() {
|
||||
public List<CanonicalResource> allConformanceResources() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -340,11 +353,21 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, byte[]> getBinaries() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateSnapshot(org.hl7.fhir.r5.model.StructureDefinition p) throws FHIRException {
|
||||
// nothing yet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateSnapshot(org.hl7.fhir.r5.model.StructureDefinition theStructureDefinition, boolean theB) {
|
||||
// nothing yet
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.hl7.fhir.r5.model.Parameters getExpansionParameters() {
|
||||
return myExpansionProfile;
|
||||
|
@ -642,18 +665,13 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<String> typeTails() {
|
||||
return myWrap.typeTails();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String system, String code, String display) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, String system, String code, String display) {
|
||||
org.hl7.fhir.dstu3.context.IWorkerContext.ValidationResult result = myWrap.validateCode(system, code, display);
|
||||
return convertValidationResult(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String system, String code, String display, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, String system, String code, String display, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
ValueSet convertedVs = null;
|
||||
|
||||
try {
|
||||
|
@ -669,7 +687,7 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, String code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
ValueSet convertedVs = null;
|
||||
try {
|
||||
if (vs != null) {
|
||||
|
@ -684,7 +702,7 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, org.hl7.fhir.r5.model.Coding code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, org.hl7.fhir.r5.model.Coding code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
Coding convertedCode = null;
|
||||
ValueSet convertedVs = null;
|
||||
|
||||
|
@ -704,7 +722,7 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, org.hl7.fhir.r5.model.CodeableConcept code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, org.hl7.fhir.r5.model.CodeableConcept code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
CodeableConcept convertedCode = null;
|
||||
ValueSet convertedVs = null;
|
||||
|
||||
|
@ -723,21 +741,6 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta
|
|||
return convertValidationResult(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String system, String code, String display, org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent vsi) {
|
||||
ValueSet.ConceptSetComponent conceptSetComponent = null;
|
||||
if (vsi != null) {
|
||||
try {
|
||||
conceptSetComponent = VersionConvertor_30_50.convertConceptSetComponent(vsi);
|
||||
} catch (FHIRException e) {
|
||||
throw new InternalErrorException(e);
|
||||
}
|
||||
}
|
||||
|
||||
org.hl7.fhir.dstu3.context.IWorkerContext.ValidationResult result = myWrap.validateCode(system, code, display, conceptSetComponent);
|
||||
return convertValidationResult(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class ResourceKey {
|
||||
|
|
|
@ -1,17 +1,24 @@
|
|||
package org.hl7.fhir.instance.hapi.validation;
|
||||
|
||||
import ca.uhn.fhir.context.*;
|
||||
import ca.uhn.fhir.context.BaseRuntimeElementDefinition;
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.context.RuntimePrimitiveDatatypeDefinition;
|
||||
import ca.uhn.fhir.rest.api.Constants;
|
||||
import ca.uhn.fhir.rest.api.EncodingEnum;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
import ca.uhn.fhir.util.XmlUtil;
|
||||
import ca.uhn.fhir.validation.IInstanceValidatorModule;
|
||||
import ca.uhn.fhir.validation.IValidationContext;
|
||||
import ca.uhn.fhir.validation.IValidatorModule;
|
||||
import com.github.benmanes.caffeine.cache.CacheLoader;
|
||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||
import com.github.benmanes.caffeine.cache.LoadingCache;
|
||||
import com.google.gson.*;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
|
@ -20,13 +27,18 @@ import org.fhir.ucum.UcumService;
|
|||
import org.hl7.fhir.converter.NullVersionConverterAdvisor50;
|
||||
import org.hl7.fhir.convertors.VersionConvertorAdvisor50;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_10_50;
|
||||
import org.hl7.fhir.dstu2.model.*;
|
||||
import org.hl7.fhir.dstu2.model.CodeableConcept;
|
||||
import org.hl7.fhir.dstu2.model.Coding;
|
||||
import org.hl7.fhir.dstu2.model.Questionnaire;
|
||||
import org.hl7.fhir.dstu2.model.StructureDefinition;
|
||||
import org.hl7.fhir.dstu2.model.ValueSet;
|
||||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.exceptions.TerminologyServiceException;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.formats.IParser;
|
||||
import org.hl7.fhir.r5.formats.ParserType;
|
||||
import org.hl7.fhir.r5.model.CanonicalResource;
|
||||
import org.hl7.fhir.r5.model.CodeSystem;
|
||||
import org.hl7.fhir.r5.model.Parameters;
|
||||
import org.hl7.fhir.r5.terminologies.ValueSetExpander;
|
||||
|
@ -36,10 +48,10 @@ import org.hl7.fhir.r5.utils.IResourceValidator;
|
|||
import org.hl7.fhir.r5.utils.IResourceValidator.BestPracticeWarningLevel;
|
||||
import org.hl7.fhir.r5.utils.IResourceValidator.IdStatus;
|
||||
import org.hl7.fhir.r5.validation.InstanceValidator;
|
||||
import org.hl7.fhir.utilities.TerminologyServiceOptions;
|
||||
import org.hl7.fhir.utilities.TranslationServices;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
@ -48,7 +60,12 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
|
@ -488,7 +505,7 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<org.hl7.fhir.r5.model.MetadataResource> allConformanceResources() {
|
||||
public List<CanonicalResource> allConformanceResources() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -497,11 +514,21 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateSnapshot(org.hl7.fhir.r5.model.StructureDefinition theStructureDefinition, boolean theB) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLinkForUrl(String corePath, String url) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, byte[]> getBinaries() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Parameters getExpansionParameters() {
|
||||
return myExpansionProfile;
|
||||
|
@ -787,18 +814,13 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<String> typeTails() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String system, String code, String display) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, String system, String code, String display) {
|
||||
org.hl7.fhir.dstu2.utils.IWorkerContext.ValidationResult result = myWrap.validateCode(system, code, display);
|
||||
return convertValidationResult(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String system, String code, String display, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, String system, String code, String display, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
ValueSet convertedVs = null;
|
||||
|
||||
try {
|
||||
|
@ -814,7 +836,7 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, String code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
ValueSet convertedVs = null;
|
||||
try {
|
||||
if (vs != null) {
|
||||
|
@ -830,7 +852,7 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, org.hl7.fhir.r5.model.Coding code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, org.hl7.fhir.r5.model.Coding code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
Coding convertedCode = null;
|
||||
ValueSet convertedVs = null;
|
||||
|
||||
|
@ -850,7 +872,7 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, org.hl7.fhir.r5.model.CodeableConcept code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, org.hl7.fhir.r5.model.CodeableConcept code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
CodeableConcept convertedCode = null;
|
||||
ValueSet convertedVs = null;
|
||||
|
||||
|
@ -869,21 +891,6 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta
|
|||
return convertValidationResult(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String system, String code, String display, org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent vsi) {
|
||||
ValueSet.ConceptSetComponent conceptSetComponent = null;
|
||||
if (vsi != null) {
|
||||
try {
|
||||
conceptSetComponent = new VersionConvertor_10_50(myAdvisor).convertConceptSetComponent(vsi);
|
||||
} catch (FHIRException e) {
|
||||
throw new InternalErrorException(e);
|
||||
}
|
||||
}
|
||||
|
||||
org.hl7.fhir.dstu2.utils.IWorkerContext.ValidationResult result = myWrap.validateCode(system, code, display, conceptSetComponent);
|
||||
return convertValidationResult(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -18,10 +18,18 @@ import org.hl7.fhir.exceptions.TerminologyServiceException;
|
|||
import org.hl7.fhir.r4.hapi.ctx.DefaultProfileValidationSupport;
|
||||
import org.hl7.fhir.r4.hapi.ctx.HapiWorkerContext;
|
||||
import org.hl7.fhir.r4.hapi.ctx.IValidationSupport;
|
||||
import org.hl7.fhir.r4.model.*;
|
||||
import org.hl7.fhir.r4.model.CodeSystem;
|
||||
import org.hl7.fhir.r4.model.CodeableConcept;
|
||||
import org.hl7.fhir.r4.model.Coding;
|
||||
import org.hl7.fhir.r4.model.ImplementationGuide;
|
||||
import org.hl7.fhir.r4.model.Questionnaire;
|
||||
import org.hl7.fhir.r4.model.Resource;
|
||||
import org.hl7.fhir.r4.model.StructureDefinition;
|
||||
import org.hl7.fhir.r4.model.ValueSet;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.formats.IParser;
|
||||
import org.hl7.fhir.r5.formats.ParserType;
|
||||
import org.hl7.fhir.r5.model.CanonicalResource;
|
||||
import org.hl7.fhir.r5.terminologies.ValueSetExpander;
|
||||
import org.hl7.fhir.r5.utils.INarrativeGenerator;
|
||||
import org.hl7.fhir.r5.utils.IResourceValidator;
|
||||
|
@ -30,10 +38,17 @@ import org.hl7.fhir.utilities.TerminologyServiceOptions;
|
|||
import org.hl7.fhir.utilities.TranslationServices;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@SuppressWarnings({"PackageAccessibility", "Duplicates"})
|
||||
|
@ -270,7 +285,7 @@ public class FhirInstanceValidator extends org.hl7.fhir.r4.hapi.validation.BaseV
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<org.hl7.fhir.r5.model.MetadataResource> allConformanceResources() {
|
||||
public List<CanonicalResource> allConformanceResources() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -279,6 +294,11 @@ public class FhirInstanceValidator extends org.hl7.fhir.r4.hapi.validation.BaseV
|
|||
// nothing yet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateSnapshot(org.hl7.fhir.r5.model.StructureDefinition theStructureDefinition, boolean theB) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.hl7.fhir.r5.model.Parameters getExpansionParameters() {
|
||||
return myExpansionProfile;
|
||||
|
@ -570,18 +590,17 @@ public class FhirInstanceValidator extends org.hl7.fhir.r4.hapi.validation.BaseV
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<String> typeTails() {
|
||||
return myWrap.typeTails();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String system, String code, String display) {
|
||||
org.hl7.fhir.r4.context.IWorkerContext.ValidationResult result = myWrap.validateCode(theOptions, system, code, display);
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, String system, String code, String display) {
|
||||
org.hl7.fhir.r4.context.IWorkerContext.ValidationResult result = myWrap.validateCode(toValidationOptions(theOptions), system, code, display);
|
||||
return convertValidationResult(result);
|
||||
}
|
||||
|
||||
private TerminologyServiceOptions toValidationOptions(ValidationOptions theOptions) {
|
||||
return new TerminologyServiceOptions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String system, String code, String display, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, String system, String code, String display, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
ValueSet convertedVs = null;
|
||||
|
||||
try {
|
||||
|
@ -592,12 +611,12 @@ public class FhirInstanceValidator extends org.hl7.fhir.r4.hapi.validation.BaseV
|
|||
throw new InternalErrorException(e);
|
||||
}
|
||||
|
||||
org.hl7.fhir.r4.context.IWorkerContext.ValidationResult result = myWrap.validateCode(theOptions, system, code, display, convertedVs);
|
||||
org.hl7.fhir.r4.context.IWorkerContext.ValidationResult result = myWrap.validateCode(toValidationOptions(theOptions), system, code, display, convertedVs);
|
||||
return convertValidationResult(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, String code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
ValueSet convertedVs = null;
|
||||
try {
|
||||
if (vs != null) {
|
||||
|
@ -607,12 +626,12 @@ public class FhirInstanceValidator extends org.hl7.fhir.r4.hapi.validation.BaseV
|
|||
throw new InternalErrorException(e);
|
||||
}
|
||||
|
||||
org.hl7.fhir.r4.context.IWorkerContext.ValidationResult result = myWrap.validateCode(theOptions, Constants.CODESYSTEM_VALIDATE_NOT_NEEDED, code, null, convertedVs);
|
||||
org.hl7.fhir.r4.context.IWorkerContext.ValidationResult result = myWrap.validateCode(toValidationOptions(theOptions), Constants.CODESYSTEM_VALIDATE_NOT_NEEDED, code, null, convertedVs);
|
||||
return convertValidationResult(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, org.hl7.fhir.r5.model.Coding code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, org.hl7.fhir.r5.model.Coding code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
Coding convertedCode = null;
|
||||
ValueSet convertedVs = null;
|
||||
|
||||
|
@ -627,12 +646,12 @@ public class FhirInstanceValidator extends org.hl7.fhir.r4.hapi.validation.BaseV
|
|||
throw new InternalErrorException(e);
|
||||
}
|
||||
|
||||
org.hl7.fhir.r4.context.IWorkerContext.ValidationResult result = myWrap.validateCode(theOptions, convertedCode, convertedVs);
|
||||
org.hl7.fhir.r4.context.IWorkerContext.ValidationResult result = myWrap.validateCode(toValidationOptions(theOptions), convertedCode, convertedVs);
|
||||
return convertValidationResult(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, org.hl7.fhir.r5.model.CodeableConcept code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, org.hl7.fhir.r5.model.CodeableConcept code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
CodeableConcept convertedCode = null;
|
||||
ValueSet convertedVs = null;
|
||||
|
||||
|
@ -647,30 +666,21 @@ public class FhirInstanceValidator extends org.hl7.fhir.r4.hapi.validation.BaseV
|
|||
throw new InternalErrorException(e);
|
||||
}
|
||||
|
||||
org.hl7.fhir.r4.context.IWorkerContext.ValidationResult result = myWrap.validateCode(theOptions, convertedCode, convertedVs);
|
||||
org.hl7.fhir.r4.context.IWorkerContext.ValidationResult result = myWrap.validateCode(toValidationOptions(theOptions), convertedCode, convertedVs);
|
||||
return convertValidationResult(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String system, String code, String display, org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent vsi) {
|
||||
ValueSet.ConceptSetComponent conceptSetComponent = null;
|
||||
if (vsi != null) {
|
||||
try {
|
||||
conceptSetComponent = org.hl7.fhir.convertors.conv40_50.ValueSet.convertConceptSetComponent(vsi);
|
||||
} catch (FHIRException e) {
|
||||
throw new InternalErrorException(e);
|
||||
}
|
||||
}
|
||||
|
||||
org.hl7.fhir.r4.context.IWorkerContext.ValidationResult result = myWrap.validateCode(theOptions, system, code, display, conceptSetComponent);
|
||||
return convertValidationResult(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLinkForUrl(String corePath, String url) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, byte[]> getBinaries() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class ResourceKey {
|
||||
|
|
|
@ -29,14 +29,20 @@ import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|||
import org.hl7.fhir.r5.utils.INarrativeGenerator;
|
||||
import org.hl7.fhir.r5.utils.IResourceValidator;
|
||||
import org.hl7.fhir.r5.utils.IResourceValidator.BestPracticeWarningLevel;
|
||||
import org.hl7.fhir.utilities.TerminologyServiceOptions;
|
||||
import org.hl7.fhir.utilities.TranslationServices;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@SuppressWarnings({"PackageAccessibility", "Duplicates"})
|
||||
|
@ -273,7 +279,7 @@ public class FhirInstanceValidator extends org.hl7.fhir.r5.hapi.validation.BaseV
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<org.hl7.fhir.r5.model.MetadataResource> allConformanceResources() {
|
||||
public List<CanonicalResource> allConformanceResources() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -282,11 +288,21 @@ public class FhirInstanceValidator extends org.hl7.fhir.r5.hapi.validation.BaseV
|
|||
// nothing yet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateSnapshot(StructureDefinition theStructureDefinition, boolean theB) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLinkForUrl(String corePath, String url) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, byte[]> getBinaries() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.hl7.fhir.r5.model.Parameters getExpansionParameters() {
|
||||
return myExpansionProfile;
|
||||
|
@ -579,18 +595,13 @@ public class FhirInstanceValidator extends org.hl7.fhir.r5.hapi.validation.BaseV
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<String> typeTails() {
|
||||
return myWrap.typeTails();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String system, String code, String display) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, String system, String code, String display) {
|
||||
org.hl7.fhir.r5.context.IWorkerContext.ValidationResult result = myWrap.validateCode(theOptions, system, code, display);
|
||||
return convertValidationResult(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String system, String code, String display, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, String system, String code, String display, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
ValueSet convertedVs = null;
|
||||
|
||||
try {
|
||||
|
@ -606,7 +617,7 @@ public class FhirInstanceValidator extends org.hl7.fhir.r5.hapi.validation.BaseV
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, String code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
ValueSet convertedVs = null;
|
||||
try {
|
||||
if (vs != null) {
|
||||
|
@ -621,7 +632,7 @@ public class FhirInstanceValidator extends org.hl7.fhir.r5.hapi.validation.BaseV
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, org.hl7.fhir.r5.model.Coding code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, org.hl7.fhir.r5.model.Coding code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
Coding convertedCode = null;
|
||||
ValueSet convertedVs = null;
|
||||
|
||||
|
@ -641,7 +652,7 @@ public class FhirInstanceValidator extends org.hl7.fhir.r5.hapi.validation.BaseV
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, org.hl7.fhir.r5.model.CodeableConcept code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
public ValidationResult validateCode(ValidationOptions theOptions, org.hl7.fhir.r5.model.CodeableConcept code, org.hl7.fhir.r5.model.ValueSet vs) {
|
||||
CodeableConcept convertedCode = null;
|
||||
ValueSet convertedVs = null;
|
||||
|
||||
|
@ -660,20 +671,6 @@ public class FhirInstanceValidator extends org.hl7.fhir.r5.hapi.validation.BaseV
|
|||
return convertValidationResult(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validateCode(TerminologyServiceOptions theOptions, String system, String code, String display, org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent vsi) {
|
||||
ValueSet.ConceptSetComponent conceptSetComponent = null;
|
||||
if (vsi != null) {
|
||||
try {
|
||||
conceptSetComponent = vsi;
|
||||
} catch (FHIRException e) {
|
||||
throw new InternalErrorException(e);
|
||||
}
|
||||
}
|
||||
|
||||
org.hl7.fhir.r5.context.IWorkerContext.ValidationResult result = myWrap.validateCode(theOptions, system, code, display, conceptSetComponent);
|
||||
return convertValidationResult(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ public class PrePopulatedValidationSupport implements IValidationSupport {
|
|||
addToMap(theStructureDefinition, myStructureDefinitions, theStructureDefinition.getUrl());
|
||||
}
|
||||
|
||||
private <T extends MetadataResource> void addToMap(T theStructureDefinition, Map<String, T> map, String theUrl) {
|
||||
private <T extends IBaseResource> void addToMap(T theStructureDefinition, Map<String, T> map, String theUrl) {
|
||||
if (isNotBlank(theUrl)) {
|
||||
map.put(theUrl, theStructureDefinition);
|
||||
|
||||
|
|
|
@ -333,7 +333,7 @@ public class ResourceValidatorDstu3Test {
|
|||
TestPatientFor327 patient = new TestPatientFor327();
|
||||
patient.setBirthDate(new Date());
|
||||
patient.setId("123");
|
||||
patient.getText().setDivAsString("<div>FOO</div>");
|
||||
patient.getText().setDivAsString("<div lang=\"en\">FOO</div>");
|
||||
patient.getText().setStatus(NarrativeStatus.GENERATED);
|
||||
patient.getLanguageElement().setValue("en");
|
||||
patient.addExtension().setUrl("http://foo").setValue(new StringType("MOD"));
|
||||
|
@ -478,7 +478,7 @@ public class ResourceValidatorDstu3Test {
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Child(name = "testCondition")
|
||||
@ca.uhn.fhir.model.api.annotation.Extension(url = "testCondition", definedLocally = true, isModifier = false)
|
||||
@ca.uhn.fhir.model.api.annotation.Extension(url = "http://testCondition", definedLocally = true, isModifier = false)
|
||||
private List<Reference> testConditions = null;
|
||||
|
||||
public List<Reference> getConditions() {
|
||||
|
|
|
@ -18,7 +18,6 @@ import org.hl7.fhir.r5.hapi.validation.FhirInstanceValidator;
|
|||
import org.hl7.fhir.r5.hapi.validation.ValidationSupportChain;
|
||||
import org.hl7.fhir.r5.model.*;
|
||||
import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent;
|
||||
import org.hl7.fhir.r5.model.Observation.ObservationStatus;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent;
|
||||
import org.hl7.fhir.r5.terminologies.ValueSetExpander;
|
||||
|
@ -160,7 +159,7 @@ public class FhirInstanceValidatorR5Test {
|
|||
String valueSetUrl = theInvocation.getArgument(4, String.class);
|
||||
IContextValidationSupport.CodeValidationResult retVal;
|
||||
if (myValidConcepts.contains(system + "___" + code)) {
|
||||
retVal = new IContextValidationSupport.CodeValidationResult(new ConceptDefinitionComponent(new CodeType(code)));
|
||||
retVal = new IContextValidationSupport.CodeValidationResult(new ConceptDefinitionComponent((code)));
|
||||
} else {
|
||||
retVal = myDefaultValidationSupport.validateCode(ctx, system, code, display, valueSetUrl);
|
||||
}
|
||||
|
@ -261,7 +260,7 @@ public class FhirInstanceValidatorR5Test {
|
|||
public void testValidateDoesntEnforceBestPracticesByDefault() {
|
||||
Observation input = new Observation();
|
||||
input.getText().setDiv(new XhtmlNode().setValue("<div>AA</div>")).setStatus(Narrative.NarrativeStatus.GENERATED);
|
||||
input.setStatus(ObservationStatus.AMENDED);
|
||||
input.setStatus(Enumerations.ObservationStatus.AMENDED);
|
||||
input.getCode().addCoding().setSystem("http://loinc.org").setCode("1234").setDisplay("FOO");
|
||||
|
||||
FhirInstanceValidator instanceModule;
|
||||
|
@ -369,7 +368,7 @@ public class FhirInstanceValidatorR5Test {
|
|||
@Ignore
|
||||
public void testCompareTimesWithDifferentTimezones() {
|
||||
Procedure procedure = new Procedure();
|
||||
procedure.setStatus(Procedure.ProcedureStatus.COMPLETED);
|
||||
procedure.setStatus(Enumerations.EventStatus.COMPLETED);
|
||||
procedure.getSubject().setReference("Patient/1");
|
||||
procedure.getCode().setText("Some proc");
|
||||
|
||||
|
@ -729,7 +728,7 @@ public class FhirInstanceValidatorR5Test {
|
|||
|
||||
input.addIdentifier().setSystem("http://acme").setValue("12345");
|
||||
input.getEncounter().setReference("http://foo.com/Encounter/9");
|
||||
input.setStatus(ObservationStatus.FINAL);
|
||||
input.setStatus(Enumerations.ObservationStatus.FINAL);
|
||||
input.getCode().addCoding().setSystem("http://loinc.org").setCode("12345");
|
||||
|
||||
myInstanceVal.setValidationSupport(myMockSupport);
|
||||
|
@ -750,7 +749,7 @@ public class FhirInstanceValidatorR5Test {
|
|||
|
||||
input.addIdentifier().setSystem("http://acme").setValue("12345");
|
||||
input.getEncounter().setReference("http://foo.com/Encounter/9");
|
||||
input.setStatus(ObservationStatus.FINAL);
|
||||
input.setStatus(Enumerations.ObservationStatus.FINAL);
|
||||
input.getCode().addCoding().setSystem("http://loinc.org").setCode("12345");
|
||||
|
||||
myInstanceVal.setValidationSupport(myMockSupport);
|
||||
|
@ -772,7 +771,7 @@ public class FhirInstanceValidatorR5Test {
|
|||
input.getMeta().addProfile("http://foo/structuredefinition/myprofile");
|
||||
|
||||
input.getCode().addCoding().setSystem("http://loinc.org").setCode("12345");
|
||||
input.setStatus(ObservationStatus.FINAL);
|
||||
input.setStatus(Enumerations.ObservationStatus.FINAL);
|
||||
|
||||
myInstanceVal.setValidationSupport(myMockSupport);
|
||||
ValidationResult output = myVal.validateWithResult(input);
|
||||
|
@ -800,7 +799,7 @@ public class FhirInstanceValidatorR5Test {
|
|||
Observation input = new Observation();
|
||||
|
||||
input.getText().setDiv(new XhtmlNode().setValue("<div>AA</div>")).setStatus(Narrative.NarrativeStatus.GENERATED);
|
||||
input.setStatus(ObservationStatus.FINAL);
|
||||
input.setStatus(Enumerations.ObservationStatus.FINAL);
|
||||
input.getCode().setText("No code here!");
|
||||
|
||||
ourLog.info(ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(input));
|
||||
|
@ -825,7 +824,7 @@ public class FhirInstanceValidatorR5Test {
|
|||
ValidationResult output = myVal.validateWithResult(input);
|
||||
logResultsAndReturnAll(output);
|
||||
assertEquals(
|
||||
"The value provided ('notvalidcode') is not in the value set http://hl7.org/fhir/ValueSet/observation-status|4.1.0 (http://hl7.org/fhir/ValueSet/observation-status, and a code is required from this value set) (error message = Unknown code[notvalidcode] in system[(none)])",
|
||||
"The value provided ('notvalidcode') is not in the value set http://hl7.org/fhir/ValueSet/observation-status|4.2.0 (http://hl7.org/fhir/ValueSet/observation-status, and a code is required from this value set) (error message = Unknown code[notvalidcode] in system[(none)])",
|
||||
output.getMessages().get(0).getMessage());
|
||||
}
|
||||
|
||||
|
@ -836,7 +835,7 @@ public class FhirInstanceValidatorR5Test {
|
|||
|
||||
myInstanceVal.setValidationSupport(myMockSupport);
|
||||
|
||||
input.setStatus(ObservationStatus.FINAL);
|
||||
input.setStatus(Enumerations.ObservationStatus.FINAL);
|
||||
input.getCode().addCoding().setSystem("http://loinc.org").setCode("12345");
|
||||
|
||||
ValidationResult output = myVal.validateWithResult(input);
|
||||
|
@ -853,7 +852,7 @@ public class FhirInstanceValidatorR5Test {
|
|||
myInstanceVal.setValidationSupport(myMockSupport);
|
||||
addValidConcept("http://acme.org", "12345");
|
||||
|
||||
input.setStatus(ObservationStatus.FINAL);
|
||||
input.setStatus(Enumerations.ObservationStatus.FINAL);
|
||||
input.getCode().addCoding().setSystem("http://acme.org").setCode("9988877");
|
||||
|
||||
ValidationResult output = myVal.validateWithResult(input);
|
||||
|
@ -871,7 +870,7 @@ public class FhirInstanceValidatorR5Test {
|
|||
myInstanceVal.setValidationSupport(myMockSupport);
|
||||
addValidConcept("http://loinc.org", "12345");
|
||||
|
||||
input.setStatus(ObservationStatus.FINAL);
|
||||
input.setStatus(Enumerations.ObservationStatus.FINAL);
|
||||
input.getCode().addCoding().setSystem("http://loinc.org").setCode("12345");
|
||||
|
||||
ValidationResult output = myVal.validateWithResult(input);
|
||||
|
@ -891,7 +890,7 @@ public class FhirInstanceValidatorR5Test {
|
|||
myInstanceVal.setValidationSupport(myMockSupport);
|
||||
addValidConcept("http://loinc.org", "12345");
|
||||
|
||||
input.setStatus(ObservationStatus.FINAL);
|
||||
input.setStatus(Enumerations.ObservationStatus.FINAL);
|
||||
input.getCode().addCoding().setSystem("http://loinc.org").setCode("1234");
|
||||
|
||||
ValidationResult output = myVal.validateWithResult(input);
|
||||
|
@ -908,7 +907,7 @@ public class FhirInstanceValidatorR5Test {
|
|||
myInstanceVal.setValidationSupport(myMockSupport);
|
||||
addValidConcept("http://acme.org", "12345");
|
||||
|
||||
input.setStatus(ObservationStatus.FINAL);
|
||||
input.setStatus(Enumerations.ObservationStatus.FINAL);
|
||||
input.getCode().addCoding().setSystem("http://acme.org").setCode("12345");
|
||||
|
||||
ValidationResult output = myVal.validateWithResult(input);
|
||||
|
|
|
@ -121,7 +121,7 @@ public class QuestionnaireResponseValidatorR5Test {
|
|||
questionnaireItemTypes[14] = QuestionnaireItemType.REFERENCE;
|
||||
questionnaireItemTypes[15] = QuestionnaireItemType.QUANTITY;
|
||||
|
||||
Type[] answerValues = new Type[itemCnt];
|
||||
DataType[] answerValues = new DataType[itemCnt];
|
||||
answerValues[0] = new BooleanType(true);
|
||||
answerValues[1] = new DecimalType(42.0);
|
||||
answerValues[2] = new IntegerType(42);
|
||||
|
@ -359,7 +359,7 @@ public class QuestionnaireResponseValidatorR5Test {
|
|||
when(myValSupport.fetchResource(any(FhirContext.class), eq(ValueSet.class), eq(valueSetRef)))
|
||||
.thenReturn(options);
|
||||
when(myValSupport.validateCode(any(FhirContext.class), eq(codeSystemUrl), eq(codeValue), any(String.class), anyString()))
|
||||
.thenReturn(new IContextValidationSupport.CodeValidationResult(new ConceptDefinitionComponent(new CodeType(codeValue))));
|
||||
.thenReturn(new IContextValidationSupport.CodeValidationResult(new ConceptDefinitionComponent(codeValue)));
|
||||
|
||||
IParser xmlParser = ourCtx.newXmlParser().setPrettyPrint(true);
|
||||
String qXml = xmlParser.encodeResourceToString(q);
|
||||
|
@ -416,7 +416,7 @@ public class QuestionnaireResponseValidatorR5Test {
|
|||
when(myValSupport.fetchResource(any(FhirContext.class), eq(ValueSet.class), eq(valueSetRef)))
|
||||
.thenReturn(options);
|
||||
when(myValSupport.validateCode(any(FhirContext.class), eq(codeSystemUrl), eq(codeValue), any(String.class), anyString()))
|
||||
.thenReturn(new IContextValidationSupport.CodeValidationResult(new ConceptDefinitionComponent(new CodeType(codeValue))));
|
||||
.thenReturn(new IContextValidationSupport.CodeValidationResult(new ConceptDefinitionComponent((codeValue))));
|
||||
|
||||
IParser xmlParser = ourCtx.newXmlParser().setPrettyPrint(true);
|
||||
String qXml = xmlParser.encodeResourceToString(q);
|
||||
|
@ -679,7 +679,7 @@ public class QuestionnaireResponseValidatorR5Test {
|
|||
|
||||
when(myValSupport.fetchResource(any(FhirContext.class), eq(Questionnaire.class), eq(qa.getQuestionnaire()))).thenReturn(questionnaire);
|
||||
when(myValSupport.fetchResource(any(FhirContext.class), eq(ValueSet.class), eq(ID_VS_SCHOOLTYPE))).thenReturn(iccSchoolTypeVs);
|
||||
when(myValSupport.validateCodeInValueSet(any(), any(), any(), any(), any(ValueSet.class) )).thenReturn(new IContextValidationSupport.CodeValidationResult(new ConceptDefinitionComponent(new CodeType(CODE_ICC_SCHOOLTYPE_PT))));
|
||||
when(myValSupport.validateCodeInValueSet(any(), any(), any(), any(), any(ValueSet.class) )).thenReturn(new IContextValidationSupport.CodeValidationResult(new ConceptDefinitionComponent(CODE_ICC_SCHOOLTYPE_PT)));
|
||||
ValidationResult errors = myVal.validateWithResult(qa);
|
||||
|
||||
ourLog.info(errors.toString());
|
||||
|
|
|
@ -261,6 +261,14 @@ public class ResourceMinimizerMojo extends AbstractMojo {
|
|||
byteCount += m.getByteCount();
|
||||
fileCount += m.getFileCount();
|
||||
|
||||
m = new ResourceMinimizerMojo();
|
||||
m.myCtx = ctxR5;
|
||||
m.targetDirectory = new File("./hapi-fhir-validation-resources-r5/src/main/resources/org/hl7/fhir/r5/model/extension");
|
||||
m.fhirVersion = "R5";
|
||||
m.execute();
|
||||
byteCount += m.getByteCount();
|
||||
fileCount += m.getFileCount();
|
||||
|
||||
ourLog.info("Trimmed {} files", fileCount);
|
||||
ourLog.info("Trimmed {} bytes", FileUtils.byteCountToDisplaySize(byteCount));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue