Skip to content
This repository has been archived by the owner on Feb 7, 2025. It is now read-only.

Commit

Permalink
Merge pull request #1072 from CDCgov/delete-demographics
Browse files Browse the repository at this point in the history
Delete Demographics
halprin authored May 8, 2024
2 parents 58b96d7 + 1c108e2 commit 70b8828
Showing 21 changed files with 7 additions and 890 deletions.
2 changes: 1 addition & 1 deletion adr/013-wrapped-domain-objects.md
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ We typically isolate libraries by creating an Interface at the library boundary.

Our business logic can then use the wrapper Interface without needing to know the actual underlying implementation, and that implementation can be changed without changing the Interface that the business logic relies on.

You can see an example of this in [Demographics.java](../app/src/main/java/gov/hhs/cdc/trustedintermediary/etor/demographics/Demographics.java) (the interface) and [HapiDemographics.java](../app/src/main/java/gov/hhs/cdc/trustedintermediary/external/hapi/HapiDemographics.java) (the implementation).
You can see an example of this in [Order.java](../etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/orders/Order.java) (the interface) and [HapiOrder.java](../etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/hapi/HapiOrder.java) (the implementation).

### Related Issues

Original file line number Diff line number Diff line change
@@ -43,10 +43,6 @@ public static ClassicHttpResponse post(
return handleResponseAndSetEntity(response);
}

public static ClassicHttpResponse post(String path, String body) throws IOException {
return post(path, body, ContentType.APPLICATION_JSON, null);
}

private static ClassicHttpResponse handleResponseAndSetEntity(Response response)
throws IOException {
var responseHandler = new ResponseHandlerWithoutException();

This file was deleted.

Original file line number Diff line number Diff line change
@@ -7,10 +7,6 @@
import gov.hhs.cdc.trustedintermediary.domainconnector.DomainResponseHelper;
import gov.hhs.cdc.trustedintermediary.domainconnector.HttpEndpoint;
import gov.hhs.cdc.trustedintermediary.domainconnector.UnableToReadOpenApiSpecificationException;
import gov.hhs.cdc.trustedintermediary.etor.demographics.ConvertAndSendDemographicsUsecase;
import gov.hhs.cdc.trustedintermediary.etor.demographics.Demographics;
import gov.hhs.cdc.trustedintermediary.etor.demographics.PatientDemographicsController;
import gov.hhs.cdc.trustedintermediary.etor.demographics.PatientDemographicsResponse;
import gov.hhs.cdc.trustedintermediary.etor.messagelink.MessageLinkStorage;
import gov.hhs.cdc.trustedintermediary.etor.messages.MessageRequestHandler;
import gov.hhs.cdc.trustedintermediary.etor.messages.SendMessageHelper;
@@ -65,20 +61,17 @@

/**
* The domain connector for the ETOR domain. It connects it with the larger trusted intermediary. It
* houses the request processing logic for the demographics and orders endpoints.
* houses the request processing logic for the orders, results, and metadata endpoints.
*/
public class EtorDomainRegistration implements DomainConnector {

static final String DEMOGRAPHICS_API_ENDPOINT = "/v1/etor/demographics";
static final String ORDERS_API_ENDPOINT = "/v1/etor/orders";
static final String METADATA_API_ENDPOINT = "/v1/etor/metadata/{id}";
static final String RESULTS_API_ENDPOINT = "/v1/etor/results";

static final String CONSOLIDATED_SUMMARY_API_ENDPOINT = "/v1/etor/metadata/summary/{sender}";

@Inject PatientDemographicsController patientDemographicsController;
@Inject OrderController orderController;
@Inject ConvertAndSendDemographicsUsecase convertAndSendDemographicsUsecase;
@Inject SendOrderUseCase sendOrderUseCase;

@Inject ResultController resultController;
@@ -94,8 +87,6 @@ public class EtorDomainRegistration implements DomainConnector {

private final Map<HttpEndpoint, Function<DomainRequest, DomainResponse>> endpoints =
Map.of(
new HttpEndpoint("POST", DEMOGRAPHICS_API_ENDPOINT, true),
this::handleDemographics,
new HttpEndpoint("POST", ORDERS_API_ENDPOINT, true), this::handleOrders,
new HttpEndpoint("GET", METADATA_API_ENDPOINT, true), this::handleMetadata,
new HttpEndpoint("POST", RESULTS_API_ENDPOINT, true), this::handleResults,
@@ -104,12 +95,6 @@ public class EtorDomainRegistration implements DomainConnector {

@Override
public Map<HttpEndpoint, Function<DomainRequest, DomainResponse>> domainRegistration() {
// Demographics
ApplicationContext.register(
PatientDemographicsController.class, PatientDemographicsController.getInstance());
ApplicationContext.register(
ConvertAndSendDemographicsUsecase.class,
ConvertAndSendDemographicsUsecase.getInstance());
// Orders
ApplicationContext.register(OrderConverter.class, HapiOrderConverter.getInstance());
ApplicationContext.register(OrderController.class, OrderController.getInstance());
@@ -177,26 +162,6 @@ public String openApiStream(String fileName) throws IOException {
return new String(openApiStream.readAllBytes(), StandardCharsets.UTF_8);
}

DomainResponse handleDemographics(DomainRequest request) {
Demographics<?> demographics;

try {
demographics = patientDemographicsController.parseDemographics(request);
convertAndSendDemographicsUsecase.convertAndSend(demographics);
} catch (FhirParseException e) {
logger.logError("Unable to parse demographics request", e);
return domainResponseHelper.constructErrorResponse(400, e);
} catch (UnableToSendMessageException e) {
logger.logError("Unable to send demographics", e);
return domainResponseHelper.constructErrorResponse(400, e);
}

PatientDemographicsResponse patientDemographicsResponse =
new PatientDemographicsResponse(demographics);

return domainResponseHelper.constructOkResponse(patientDemographicsResponse);
}

DomainResponse handleOrders(DomainRequest request) {
return handleMessageRequest(
request,

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package gov.hhs.cdc.trustedintermediary.etor.orders;

import gov.hhs.cdc.trustedintermediary.etor.demographics.Demographics;

/** Interface for converting things to orders and things in orders. */
public interface OrderConverter {
Order<?> convertToOrder(Demographics<?> demographics);

Order<?> convertToOmlOrder(Order<?> order);

Order<?> addContactSectionToPatientResource(Order<?> order);

This file was deleted.

Loading

0 comments on commit 70b8828

Please sign in to comment.