use of com.b2international.snowowl.fhir.core.model.codesystem.SubsumptionRequest in project snow-owl by b2ihealthcare.
the class FhirCodeSystemSubsumesOperationController method subsumes.
/*
* Subsumes POST method without codeSystemId and body
*/
@Operation(summary = "Subsumption testing", description = "Test the subsumption relationship between code/Coding A and code/Coding B given the semantics of subsumption in the underlying code system (see hierarchyMeaning).")
@ApiResponses({ @ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Not found"), @ApiResponse(responseCode = "400", description = "Bad request") })
@PostMapping(value = "/$subsumes", consumes = AbstractFhirController.APPLICATION_FHIR_JSON)
public Promise<Parameters.Fhir> subsumes(@Parameter(description = "The lookup request parameters") @RequestBody Parameters.Fhir body) {
SubsumptionRequest request = toRequest(body, SubsumptionRequest.class);
validateSubsumptionRequest(request);
return FhirRequests.codeSystems().prepareSubsumes().setRequest(request).buildAsync().execute(getBus()).then(this::toResponse);
}
use of com.b2international.snowowl.fhir.core.model.codesystem.SubsumptionRequest in project snow-owl by b2ihealthcare.
the class SubsumptionRequestDeserializationTest method lookupRequestCodingTest.
@Test
public void lookupRequestCodingTest() throws Exception {
String jsonParam = "{\"resourceType\":\"Parameters\"," + "\"parameter\":[" + "{\"name\":\"system\",\"valueUri\":\"http://snomed.info/sct\"}," + "{\"name\":\"codingA\", \"valueCoding\":" + "{\"code\":\"1234\"," + "\"system\":\"http://snomed.info/sct/version/20180131\"," + "\"userSelected\":false}" + "}," + "{\"name\":\"codingB\", \"valueCoding\":" + "{\"code\":\"5678\"," + "\"system\":\"http://snomed.info/sct/version/20180131\"," + "\"userSelected\":false}" + "}" + "]}";
// Magic to turn the FHIR params -> Parameters -> LookupRequest
Parameters.Fhir fhirParameters = objectMapper.readValue(jsonParam, Parameters.Fhir.class);
SubsumptionRequest request = objectMapper.convertValue(fhirParameters.toJson(), SubsumptionRequest.class);
assertEquals("http://snomed.info/sct", request.getSystem());
assertEquals("1234", request.getCodingA().getCodeValue());
assertEquals("5678", request.getCodingB().getCodeValue());
}
use of com.b2international.snowowl.fhir.core.model.codesystem.SubsumptionRequest in project snow-owl by b2ihealthcare.
the class SubsumptionRequestDeserializationTest method lookupRequestCodeTest.
@Test
public void lookupRequestCodeTest() throws Exception {
String jsonParam = "{\"resourceType\":\"Parameters\"," + "\"parameter\":[" + "{\"name\":\"codeA\",\"valueCode\":\"1234\"}," + "{\"name\":\"codeB\",\"valueCode\":\"5678\"}," + "{\"name\":\"system\",\"valueUri\":\"http://snomed.info/sct\"}," + "{\"name\":\"version\",\"valueString\":\"20180131\"}" + "]}";
// Magic to turn the FHIR params -> Parameters -> LookupRequest
Parameters.Fhir fhirParameters = objectMapper.readValue(jsonParam, Parameters.Fhir.class);
SubsumptionRequest request = objectMapper.convertValue(fhirParameters.toJson(), SubsumptionRequest.class);
assertEquals("1234", request.getCodeA());
assertEquals("5678", request.getCodeB());
assertEquals("http://snomed.info/sct", request.getSystem());
assertEquals("20180131", request.getVersion());
}
use of com.b2international.snowowl.fhir.core.model.codesystem.SubsumptionRequest in project snow-owl by b2ihealthcare.
the class FhirCodeSystemSubsumesOperationController method subsumes.
/*
* Subsumes GET method with no codeSystemId and parameters
*/
@Operation(summary = "Subsumption testing", description = "Test the subsumption relationship between code/Coding A and code/Coding B given the semantics of subsumption in the underlying code system (see hierarchyMeaning).")
@ApiResponses({ @ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Bad request"), @ApiResponse(responseCode = "404", description = "CodeSystem not found") })
@GetMapping("/$subsumes")
public Promise<Parameters.Fhir> subsumes(@Parameter(description = "The \"A\" code that is to be tested") @RequestParam(value = "codeA") final String codeA, @Parameter(description = "The \"B\" code that is to be tested") @RequestParam(value = "codeB") final String codeB, @Parameter(description = "The code system's uri") @RequestParam(value = "system") final String system, @Parameter(description = "The code system version") @RequestParam(value = "version", required = false) final String version) {
validateSubsumptionRequest(codeA, codeB, system, version);
final SubsumptionRequest req = SubsumptionRequest.builder().codeA(codeA).codeB(codeB).system(system).version(version).build();
return FhirRequests.codeSystems().prepareSubsumes().setRequest(req).buildAsync().execute(getBus()).then(this::toResponse);
}
use of com.b2international.snowowl.fhir.core.model.codesystem.SubsumptionRequest in project snow-owl by b2ihealthcare.
the class FhirCodeSystemSubsumesOperationController method subsumes.
/*
* Subsumes POST method with code system as path parameter
*/
@Operation(summary = "Subsumption testing", description = "Test the subsumption relationship between code/Coding A and code/Coding B given the semantics of subsumption in the underlying code system (see hierarchyMeaning).")
@ApiResponses({ @ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Not found"), @ApiResponse(responseCode = "400", description = "Bad request") })
@PostMapping(value = "{codeSystemId:**}/$subsumes", consumes = AbstractFhirController.APPLICATION_FHIR_JSON)
public Promise<Parameters.Fhir> subsumes(@Parameter(description = "The id of the code system to invoke the operation on") @PathVariable("codeSystemId") String codeSystemId, @Parameter(description = "The lookup request parameters") @RequestBody Parameters.Fhir body) {
SubsumptionRequest request = toRequest(body, SubsumptionRequest.class);
validateSubsumptionRequest(request);
// TODO: incorrect as it should use the codeSystemID instead of the systemID!
return FhirRequests.codeSystems().prepareSubsumes().setRequest(request).buildAsync().execute(getBus()).then(this::toResponse);
}
Aggregations