use of org.hl7.fhir.r5.model.CapabilityStatement in project ab2d by CMSgov.
the class CapabilityAPIV2 method capabilityStatement.
@Operation(summary = CAP_REQ)
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = CAP_DESC + " http://hl7.org/fhir/capabilitystatement.html") })
@ResponseStatus(value = HttpStatus.OK)
@GetMapping(value = "/metadata")
public ResponseEntity<String> capabilityStatement(HttpServletRequest request) {
IParser parser = R4.getJsonParser();
eventLogger.log(new ApiResponseEvent(MDC.get(ORGANIZATION), null, HttpStatus.OK, CAP_STMT, CAP_RET, (String) request.getAttribute(REQUEST_ID)));
String server = common.getCurrentUrl(request).replace("/metadata", "");
CapabilityStatement capabilityStatement = CapabilityStatementR4.populateCS(server);
return new ResponseEntity<>(parser.encodeResourceToString(capabilityStatement), null, HttpStatus.OK);
}
use of org.hl7.fhir.r5.model.CapabilityStatement 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;
}
use of org.hl7.fhir.r5.model.CapabilityStatement in project org.hl7.fhir.core by hapifhir.
the class PackageMaintainer method check.
private void check(String ver) throws IOException {
System.out.println("Check " + ver);
List<String> allIds = listResources(Utilities.path(PATH, "hl7.fhir." + ver + ".examples", "package"));
List<String> coreIds = listResources(Utilities.path(PATH, "hl7.fhir." + ver + ".core", "package"));
for (String s : coreIds) {
if (!allIds.contains(s)) {
System.out.println("Core contains " + s + " but allIds doesn't");
}
}
for (String s : allIds) {
if (!coreIds.contains(s)) {
String c = s.substring(0, s.indexOf("-"));
if (Utilities.existsInList(c, "CodeSystem", "ValueSet", "ConceptMap", "StructureDefinition", "StructureMap", "NamingSystem", "SearchParameter", "OperationDefinition", "CapabilityStatement", "Conformance"))
System.out.println("Examples contains " + s + " but core doesn't");
}
}
strip(new File(Utilities.path(PATH, "hl7.fhir." + ver + ".core", "package")));
strip(new File(Utilities.path(PATH, "hl7.fhir." + ver + ".expansions", "package")));
if (!ver.equals("r2b"))
strip(new File(Utilities.path(PATH, "hl7.fhir." + ver + ".elements", "package")));
}
use of org.hl7.fhir.r5.model.CapabilityStatement in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeCapabilityStatement.
protected void composeCapabilityStatement(Complex parent, String parentType, String name, CapabilityStatement element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "CapabilityStatement", name, element, index);
if (element.hasUrlElement())
composeUri(t, "CapabilityStatement", "url", element.getUrlElement(), -1);
if (element.hasVersionElement())
composeString(t, "CapabilityStatement", "version", element.getVersionElement(), -1);
if (element.hasNameElement())
composeString(t, "CapabilityStatement", "name", element.getNameElement(), -1);
if (element.hasTitleElement())
composeString(t, "CapabilityStatement", "title", element.getTitleElement(), -1);
if (element.hasStatusElement())
composeEnum(t, "CapabilityStatement", "status", element.getStatusElement(), -1);
if (element.hasExperimentalElement())
composeBoolean(t, "CapabilityStatement", "experimental", element.getExperimentalElement(), -1);
if (element.hasDateElement())
composeDateTime(t, "CapabilityStatement", "date", element.getDateElement(), -1);
if (element.hasPublisherElement())
composeString(t, "CapabilityStatement", "publisher", element.getPublisherElement(), -1);
for (int i = 0; i < element.getContact().size(); i++) composeContactDetail(t, "CapabilityStatement", "contact", element.getContact().get(i), i);
if (element.hasDescriptionElement())
composeMarkdown(t, "CapabilityStatement", "description", element.getDescriptionElement(), -1);
for (int i = 0; i < element.getUseContext().size(); i++) composeUsageContext(t, "CapabilityStatement", "useContext", element.getUseContext().get(i), i);
for (int i = 0; i < element.getJurisdiction().size(); i++) composeCodeableConcept(t, "CapabilityStatement", "jurisdiction", element.getJurisdiction().get(i), i);
if (element.hasPurposeElement())
composeMarkdown(t, "CapabilityStatement", "purpose", element.getPurposeElement(), -1);
if (element.hasCopyrightElement())
composeMarkdown(t, "CapabilityStatement", "copyright", element.getCopyrightElement(), -1);
if (element.hasKindElement())
composeEnum(t, "CapabilityStatement", "kind", element.getKindElement(), -1);
for (int i = 0; i < element.getInstantiates().size(); i++) composeUri(t, "CapabilityStatement", "instantiates", element.getInstantiates().get(i), i);
if (element.hasSoftware())
composeCapabilityStatementCapabilityStatementSoftwareComponent(t, "CapabilityStatement", "software", element.getSoftware(), -1);
if (element.hasImplementation())
composeCapabilityStatementCapabilityStatementImplementationComponent(t, "CapabilityStatement", "implementation", element.getImplementation(), -1);
if (element.hasFhirVersionElement())
composeId(t, "CapabilityStatement", "fhirVersion", element.getFhirVersionElement(), -1);
if (element.hasAcceptUnknownElement())
composeEnum(t, "CapabilityStatement", "acceptUnknown", element.getAcceptUnknownElement(), -1);
for (int i = 0; i < element.getFormat().size(); i++) composeCode(t, "CapabilityStatement", "format", element.getFormat().get(i), i);
for (int i = 0; i < element.getPatchFormat().size(); i++) composeCode(t, "CapabilityStatement", "patchFormat", element.getPatchFormat().get(i), i);
for (int i = 0; i < element.getImplementationGuide().size(); i++) composeUri(t, "CapabilityStatement", "implementationGuide", element.getImplementationGuide().get(i), i);
for (int i = 0; i < element.getProfile().size(); i++) composeReference(t, "CapabilityStatement", "profile", element.getProfile().get(i), i);
for (int i = 0; i < element.getRest().size(); i++) composeCapabilityStatementCapabilityStatementRestComponent(t, "CapabilityStatement", "rest", element.getRest().get(i), i);
for (int i = 0; i < element.getMessaging().size(); i++) composeCapabilityStatementCapabilityStatementMessagingComponent(t, "CapabilityStatement", "messaging", element.getMessaging().get(i), i);
for (int i = 0; i < element.getDocument().size(); i++) composeCapabilityStatementCapabilityStatementDocumentComponent(t, "CapabilityStatement", "document", element.getDocument().get(i), i);
}
use of org.hl7.fhir.r5.model.CapabilityStatement in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeCapabilityStatementCapabilityStatementMessagingEventComponent.
protected void composeCapabilityStatementCapabilityStatementMessagingEventComponent(Complex parent, String parentType, String name, CapabilityStatement.CapabilityStatementMessagingEventComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "event", name, element, index);
if (element.hasCode())
composeCoding(t, "CapabilityStatement", "code", element.getCode(), -1);
if (element.hasCategoryElement())
composeEnum(t, "CapabilityStatement", "category", element.getCategoryElement(), -1);
if (element.hasModeElement())
composeEnum(t, "CapabilityStatement", "mode", element.getModeElement(), -1);
if (element.hasFocusElement())
composeCode(t, "CapabilityStatement", "focus", element.getFocusElement(), -1);
if (element.hasRequest())
composeReference(t, "CapabilityStatement", "request", element.getRequest(), -1);
if (element.hasResponse())
composeReference(t, "CapabilityStatement", "response", element.getResponse(), -1);
if (element.hasDocumentationElement())
composeString(t, "CapabilityStatement", "documentation", element.getDocumentationElement(), -1);
}
Aggregations