Skip to content

Commit

Permalink
Merge branch 'develop' into snyk-fix-f56e4dd7192316f42cceb38c1e06eff2
Browse files Browse the repository at this point in the history
  • Loading branch information
adongare authored Nov 21, 2024
2 parents 9f086da + 602835c commit 974405b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.10</version>
<version>3.2.11</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import gov.cms.madie.terminology.service.MappingService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.Enumerations.PublicationStatus;
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.r4.model.Identifier;
Expand Down Expand Up @@ -55,8 +56,7 @@ protected ValueSet setFhirMainAttributes(
fhirValueSet.setName(vsacDescribedValueSet.getDisplayName());
fhirValueSet.setTitle(vsacDescribedValueSet.getDisplayName());
fhirValueSet.setVersion(vsacDescribedValueSet.getVersion());
fhirValueSet.setStatus(
PublicationStatus.fromCode(vsacDescribedValueSet.getStatus().toLowerCase()));
fhirValueSet.setStatus(mapVsacValueSetStatusToFhir(vsacDescribedValueSet.getStatus()));
fhirValueSet.setDate(vsacDescribedValueSet.getRevisionDate().toGregorianCalendar().getTime());
fhirValueSet.setPublisher(vsacDescribedValueSet.getSource());
// ??
Expand All @@ -65,6 +65,14 @@ protected ValueSet setFhirMainAttributes(
return fhirValueSet;
}

private PublicationStatus mapVsacValueSetStatusToFhir(String vsacStatus) {
try {
return PublicationStatus.fromCode(vsacStatus.toLowerCase());
} catch (FHIRException | NullPointerException e) {
return PublicationStatus.UNKNOWN;
}
}

protected void addFhirValueSetComposeComponent(
List<Concept> vsacConceptList, ValueSet fhirValueSet) {
ValueSetComposeComponent fhirValueSetComposeComponent = new ValueSetComposeComponent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;

import org.hl7.fhir.r4.model.Enumerations;
import org.hl7.fhir.r4.model.ValueSet;
import org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent;
import org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent;
Expand Down Expand Up @@ -143,6 +144,14 @@ public void testSetFhirMainAttributes() {
assertEquals(vs.getDate(), today);
}

@Test
public void testMapMainAttributesUnknownStatus() {
ValueSet vs = new ValueSet();
describedValueSet.setStatus("Not Maintained");
vs = mapper.setFhirMainAttributes(vs, describedValueSet, TEST);
assertEquals(Enumerations.PublicationStatus.UNKNOWN.getDisplay(), vs.getStatus().getDisplay());
}

@Test
public void testGetVsacCodeMap() {

Expand Down

0 comments on commit 974405b

Please sign in to comment.