use of org.hl7.fhir.r4.model.ValueSet in project quality-measure-and-cohort-service by Alvearie.
the class ValueSetUtilTest method testUnsuppliedCodes.
@Test
public void testUnsuppliedCodes() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Value set must include codes but no codes were included.");
ValueSetArtifact artifact = new ValueSetArtifact();
artifact.setUrl("fakeUrl");
ValueSet fakeValueSet = new ValueSet();
fakeValueSet.setId("fakeId");
fakeValueSet.setVersion("fakeVersion");
artifact.setFhirResource(fakeValueSet);
ValueSetUtil.validateArtifact(artifact);
}
use of org.hl7.fhir.r4.model.ValueSet in project quality-measure-and-cohort-service by Alvearie.
the class ValueSetUtilTest method testUnsuppliedVersion.
@Test
public void testUnsuppliedVersion() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Value Set Version must be supplied");
ValueSetArtifact artifact = new ValueSetArtifact();
artifact.setUrl("fakeUrl");
ValueSet fakeValueSet = new ValueSet();
fakeValueSet.setId("fakeId");
artifact.setFhirResource(fakeValueSet);
ValueSetUtil.validateArtifact(artifact);
}
use of org.hl7.fhir.r4.model.ValueSet in project quality-measure-and-cohort-service by Alvearie.
the class ValueSetUtilTest method testCorrectValidation.
@Test
public void testCorrectValidation() {
ValueSetArtifact artifact = new ValueSetArtifact();
artifact.setUrl("fakeUrl");
ValueSet fakeValueSet = new ValueSet();
fakeValueSet.setId("fakeId");
fakeValueSet.setVersion("fakeVersion");
ValueSet.ValueSetComposeComponent compose = new ValueSet.ValueSetComposeComponent();
ValueSet.ConceptSetComponent component = new ValueSet.ConceptSetComponent();
component.setConcept(Collections.singletonList(new ValueSet.ConceptReferenceComponent(new CodeType("fakeCode"))));
compose.setInclude(Collections.singletonList(component));
fakeValueSet.setCompose(compose);
artifact.setFhirResource(fakeValueSet);
ValueSetUtil.validateArtifact(artifact);
}
use of org.hl7.fhir.r4.model.ValueSet in project elexis-server by elexis.
the class ValueSetResourceProvider method search.
@Search
public ValueSet search(@RequiredParam(name = ValueSet.SP_URL) UriParam urlParam, @OptionalParam(name = "_text") StringParam textParam) {
// TODO useContext (law, date etc)
Optional<ICodeElementServiceContribution> contribution = getCodeElementServiceContributionByUri(codeElementService, urlParam.getValue());
if (contribution.isPresent()) {
Map<Object, Object> singletonMap = Collections.singletonMap(ICodeElementServiceContribution.CONTEXT_KEYS.DISPLAY, textParam.getValue());
List<ICodeElement> elements = contribution.get().getElements(singletonMap);
ValueSet valueSet = getTransformer().getFhirObject(elements).get();
valueSet.getCompose().getInclude().get(0).setSystem(urlParam.getValue());
return valueSet;
}
return null;
}
use of org.hl7.fhir.r4.model.ValueSet in project ab2d by CMSgov.
the class CapabilityStatementR4 method populateCS.
public static CapabilityStatement populateCS(String server) {
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
CapabilityStatement cs = new CapabilityStatement();
cs.setPublisher("Centers for Medicare & Medicaid Services");
cs.setKind(CapabilityStatement.CapabilityStatementKind.REQUIREMENTS);
cs.setStatus(Enumerations.PublicationStatus.DRAFT);
try {
Date lastUpdated = sdf.parse("02/22/2020 00:00:00");
cs.setDate(lastUpdated);
} catch (Exception ex) {
cs.setDate(new Date());
}
cs.setFhirVersion(Enumerations.FHIRVersion._4_0_0);
cs.setPurpose("Defines FHIR R4 (V2) version of AB2D bulk data download");
CodeType codeType = new CodeType();
codeType.setValue(APPLICATION_JSON);
CodeType codeType2 = new CodeType();
codeType2.setValue("application/fhir+json");
cs.setFormat(List.of(codeType, codeType2));
CapabilityStatement.CapabilityStatementSoftwareComponent cssc = new CapabilityStatement.CapabilityStatementSoftwareComponent();
cssc.setName("AB2D");
cssc.setVersion("V2");
try {
Date releaseDate = sdf.parse("05/01/2020 00:00:00");
cssc.setReleaseDate(releaseDate);
} catch (Exception ex) {
cssc.setReleaseDate(new Date());
}
cs.setSoftware(cssc);
CapabilityStatement.CapabilityStatementImplementationComponent implementation = new CapabilityStatement.CapabilityStatementImplementationComponent();
implementation.setDescription("AB2D FHIR R4 Bulk Data Download Implementation");
implementation.setUrl(server);
cs.setImplementation(implementation);
CapabilityStatement.CapabilityStatementRestComponent rest = new CapabilityStatement.CapabilityStatementRestComponent();
rest.setMode(CapabilityStatement.RestfulCapabilityMode.SERVER);
CapabilityStatement.CapabilityStatementRestSecurityComponent security = new CapabilityStatement.CapabilityStatementRestSecurityComponent();
security.setCors(true);
CodeableConcept codeableConcept = new CodeableConcept();
Coding coding = new Coding();
coding.setSystem("http://hl7.org/fhir/ValueSet/restful-security-service");
coding.setCode("OAuth");
coding.setDisplay("OAuth");
codeableConcept.setCoding(List.of(coding));
codeableConcept.setText("OAuth");
security.setService(List.of(codeableConcept));
rest.setSecurity(security);
List<CapabilityStatement.CapabilityStatementRestResourceOperationComponent> restComponents = new ArrayList<>();
restComponents.add(createOperation("export", server + "/Patient/$export"));
restComponents.add(createOperation("export by contract", server + "/Group/{contractNumber}/$export"));
restComponents.add(createOperation("cancel", server + "/Job/{jobUuid}/$status"));
restComponents.add(createOperation("status", server + "/Job/{jobUuid}/$status"));
restComponents.add(createOperation("download", server + "/Job/{jobUuid}/file/{filename}"));
restComponents.add(createOperation("capability", server + "/metadata"));
rest.setOperation(restComponents);
rest.setInteraction(List.of(new CapabilityStatement.SystemInteractionComponent().setCode(CapabilityStatement.SystemRestfulInteraction.BATCH)));
cs.setRest(List.of(rest));
return cs;
}
Aggregations