Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete Demographics #1072

Merged
merged 6 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion adr/013-wrapped-domain-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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,
Expand All @@ -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());
Expand Down Expand Up @@ -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,
Expand Down

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);
Expand Down

This file was deleted.

Loading
Loading