Merge pull request #1446 from jamesagnew/1445-an-implicit-all-loinc-valueset-needs-to-be-created-when-uploading-the-loinc-codesystem

Resolve "An implicit all-loinc ValueSet needs to be created when uploading the LOINC CodeSystem."
This commit is contained in:
Diederik Muylwyk 2019-08-26 16:48:07 -04:00 committed by GitHub
commit e5c8ffdc20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 8 deletions

View File

@ -32,6 +32,7 @@ import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.CodeSystem;
import org.hl7.fhir.r4.model.ConceptMap;
import org.hl7.fhir.r4.model.Enumerations;
import org.hl7.fhir.r4.model.ValueSet;
import org.springframework.beans.factory.annotation.Autowired;
@ -556,6 +557,8 @@ public class TerminologyLoaderSvcImpl implements IHapiTerminologyLoaderSvc {
IOUtils.closeQuietly(theDescriptors);
valueSets.add(getValueSetLoincAll());
for (Entry<String, TermConcept> next : code2concept.entrySet()) {
TermConcept nextConcept = next.getValue();
if (nextConcept.getParents().isEmpty()) {
@ -573,6 +576,23 @@ public class TerminologyLoaderSvcImpl implements IHapiTerminologyLoaderSvc {
return new UploadStatistics(conceptCount, target);
}
private ValueSet getValueSetLoincAll() {
ValueSet retVal = new ValueSet();
retVal.setId("loinc-all");
retVal.setUrl("http://loinc.org/fhir/ValueSet/loinc-all");
retVal.setVersion("1.0.0");
retVal.setName("All LOINC codes");
retVal.setStatus(Enumerations.PublicationStatus.ACTIVE);
retVal.setDate(new Date());
retVal.setPublisher("Regenstrief Institute, Inc.");
retVal.setDescription("A value set that includes all LOINC codes");
retVal.setCopyright("This content from LOINC® is copyright © 1995 Regenstrief Institute, Inc. and the LOINC Committee, and available at no cost under the license at https://loinc.org/license/");
retVal.getCompose().addInclude().setSystem(IHapiTerminologyLoaderSvc.LOINC_URI);
return retVal;
}
private UploadStatistics processSnomedCtFiles(LoadedFileDescriptors theDescriptors, RequestDetails theRequestDetails) {
final TermCodeSystemVersion codeSystemVersion = new TermCodeSystemVersion();
final Map<String, TermConcept> id2concept = new HashMap<>();

View File

@ -255,6 +255,22 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
assertEquals("42176-8", vs.getCompose().getInclude().get(0).getConcept().get(0).getCode());
assertEquals("1,3 beta glucan [Mass/volume] in Serum", vs.getCompose().getInclude().get(0).getConcept().get(0).getDisplay());
// All LOINC codes
assertTrue(valueSets.containsKey("loinc-all"));
vs = valueSets.get("loinc-all");
assertEquals("http://loinc.org/fhir/ValueSet/loinc-all", vs.getUrl());
assertEquals("1.0.0", vs.getVersion());
assertEquals("All LOINC codes", vs.getName());
assertEquals(Enumerations.PublicationStatus.ACTIVE, vs.getStatus());
assertTrue(vs.hasDate());
assertEquals("Regenstrief Institute, Inc.", vs.getPublisher());
assertEquals("A value set that includes all LOINC codes", vs.getDescription());
assertEquals("This content from LOINC® is copyright © 1995 Regenstrief Institute, Inc. and the LOINC Committee, and available at no cost under the license at https://loinc.org/license/", vs.getCopyright());
assertTrue(vs.hasCompose());
assertTrue(vs.getCompose().hasInclude());
assertEquals(1, vs.getCompose().getInclude().size());
assertEquals(IHapiTerminologyLoaderSvc.LOINC_URI, vs.getCompose().getInclude().get(0).getSystem());
// IEEE Medical Device Codes
conceptMap = conceptMaps.get(LoincIeeeMedicalDeviceCodeHandler.LOINC_IEEE_CM_ID);
ourLog.debug(FhirContext.forR4().newXmlParser().setPrettyPrint(true).encodeResourceToString(conceptMap));

View File

@ -29,6 +29,7 @@ import org.springframework.transaction.support.TransactionTemplate;
import javax.annotation.Nonnull;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger;
@ -606,14 +607,6 @@ public class TerminologySvcImplR4Test extends BaseJpaR4Test {
loadAndPersistCodeSystem();
}
@Test
public void testTest() {
ourLog.info("as is: {}", TermValueSetPreExpansionStatusEnum.EXPANSION_IN_PROGRESS);
ourLog.info("toString: {}", TermValueSetPreExpansionStatusEnum.EXPANSION_IN_PROGRESS.toString());
ourLog.info("name: {}", TermValueSetPreExpansionStatusEnum.EXPANSION_IN_PROGRESS.name());
ourLog.info("getCode: {}", TermValueSetPreExpansionStatusEnum.EXPANSION_IN_PROGRESS.getCode());
}
@Test
public void testDuplicateConceptMapUrls() {
createAndPersistConceptMap();

View File

@ -82,6 +82,11 @@
LOINC concepts now include multiaxial hierarchical properties (e.g. <![CDATA[<code>parent</code>]]> and
<![CDATA[<code>child</code>]]>, which identify parent and child concepts.
</action>
<action type="add" issue="1445">
When loading LOINC terminology, a new ValueSet is automatically created with a single include element that
identifies the LOINC CodeSystem in <![CDATA[<code>ValueSet.compose.include.system</code>]]>. This ValueSet
includes all LOINC codes.
</action>
</release>
<release version="4.0.0" date="2019-08-14" description="Igloo">
<action type="add">