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

fix : update source and origin in fhir table#745 #908

Merged
merged 1 commit into from
Dec 18, 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
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,10 @@ private void saveScreeningGroup(final String groupInteractionId, final HttpServl
initRIHR.setContentType(MimeTypeUtils.APPLICATION_JSON_VALUE);
initRIHR.setCsvZipFileName(file.getOriginalFilename());
initRIHR.setSourceHubInteractionId(interactionId);
final InetAddress localHost = InetAddress.getLocalHost();
final String ipAddress = localHost.getHostAddress();
initRIHR.setClientIpAddress(ipAddress);
initRIHR.setUserAgent(request.getHeader("User-Agent"));
for (final FileDetail fileDetail : fileDetailList) {
switch (fileDetail.fileType()) {
case FileType.DEMOGRAPHIC_DATA -> {
Expand Down Expand Up @@ -384,7 +388,8 @@ private void saveValidationResults(final Map<String, Object> validationResults,
final var initRIHR = new RegisterInteractionHttpRequest();
try {
initRIHR.setInteractionId(groupInteractionId);
initRIHR.setGroupHubInteractionId(masterInteractionId);
initRIHR.setGroupHubInteractionId(groupInteractionId);
initRIHR.setSourceHubInteractionId(masterInteractionId);
initRIHR.setInteractionKey(request.getRequestURI());
initRIHR.setNature((JsonNode) Configuration.objectMapper.valueToTree(
Map.of("nature", "CSV Validation Result", "tenant_id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.techbd.model.csv.QeAdminData;
import org.techbd.model.csv.ScreeningObservationData;
import org.techbd.model.csv.ScreeningProfileData;
import org.techbd.service.constants.SourceType;
import org.techbd.service.converters.csv.CsvToFhirConverter;
import org.techbd.service.http.hub.prime.api.FHIRService;
import org.techbd.udi.UdiPrimeJpaConfig;
Expand Down Expand Up @@ -134,7 +135,7 @@ private void saveConvertedFHIR(boolean isValid, String masterInteractionId, Stri
initRIHR.setCreatedAt(forwardedAt);
initRIHR.setCreatedBy(CsvService.class.getName());
initRIHR.setFromState(isValid ? "VALIDATION SUCCESS" : "VALIDATION FAILED");
initRIHR.setFromState(isPayloadInstanceOfBundle(payload) ? "CONVERTED_TO_FHIR" : "FHIR_CONVERSION_FAILED");
initRIHR.setToState(isPayloadInstanceOfBundle(payload) ? "CONVERTED_TO_FHIR" : "FHIR_CONVERSION_FAILED");
final var provenance = "%s.saveConvertedFHIR".formatted(CsvBundleProcessorService.class.getName());
initRIHR.setProvenance(provenance);
initRIHR.setCsvGroupId(groupKey);
Expand Down Expand Up @@ -246,7 +247,7 @@ private List<Object> processScreeningProfileData(String groupKey,
results.add(fhirService.processBundle(
bundle, tenantId, null, null, null, null, null,
Boolean.toString(false), false,
false, false, request, response, null, true, null,interactionId,groupInteractionId,masterInteractionId));
false, false, request, response, null, true, null,interactionId,groupInteractionId,masterInteractionId,SourceType.CSV.name()));
} else {
results.add(createOperationOutcomeForError(masterInteractionId, interactionId,
profile.getPatientMrIdValue(), new Exception("Bundle not created")));
Expand Down
5 changes: 3 additions & 2 deletions hub-prime/src/main/java/org/techbd/service/CsvService.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.springframework.web.multipart.MultipartFile;
import org.techbd.conf.Configuration;
import org.techbd.orchestrate.csv.CsvOrchestrationEngine;
import org.techbd.service.constants.Origin;
import org.techbd.service.http.Interactions;
import org.techbd.service.http.InteractionsFilter;
import org.techbd.udi.UdiPrimeJpaConfig;
Expand Down Expand Up @@ -83,7 +84,7 @@ private void saveArchiveInteraction(final org.jooq.Configuration jooqCfg, final
final var forwardedAt = OffsetDateTime.now();
final var initRIHR = new RegisterInteractionHttpRequest();
try {
initRIHR.setOrigin("http");
initRIHR.setOrigin(Origin.HTTP.name());
initRIHR.setInteractionId(interactionId);
initRIHR.setInteractionKey(request.getRequestURI());
initRIHR.setNature((JsonNode) Configuration.objectMapper.valueToTree(
Expand All @@ -94,7 +95,7 @@ private void saveArchiveInteraction(final org.jooq.Configuration jooqCfg, final
initRIHR.setCsvZipFileName(file.getOriginalFilename());
initRIHR.setCreatedAt(forwardedAt);
final InetAddress localHost = InetAddress.getLocalHost();
final String ipAddress = localHost.getHostAddress();
final String ipAddress = localHost.getHostAddress();
initRIHR.setClientIpAddress(ipAddress);
initRIHR.setUserAgent(request.getHeader("User-Agent"));
initRIHR.setCreatedBy(CsvService.class.getName());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.techbd.service.constants;

public enum Origin {
HTTP,
SFTP

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.techbd.service.constants;

public enum SourceType {
FHIR,
CSV,
HL7
}
Loading
Loading