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

Fixes for MPI communication issues #30

Merged
merged 2 commits into from
Jan 5, 2022
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
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ on:
branches: [ main ]
pull_request:
branches: [ main ]

release:
types: [ created ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

Expand Down Expand Up @@ -56,3 +57,8 @@ jobs:
githubServer: false
- name: Build with Maven
run: mvn -P 'github-packages' install
- name: Publish package
run: mvn -P github-packages -DskipTests -Dfindbugs.skip=true -Dpmd.skip=true -Dcpd.skip=true -B deploy
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
if: github.event_name == 'release' && github.event.action == 'created'
44 changes: 0 additions & 44 deletions .github/workflows/release.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,22 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.*;
import java.util.stream.Collectors;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.Include;
import ca.uhn.fhir.rest.api.EncodingEnum;
import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.client.api.IGenericClient;
import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
import ca.uhn.fhir.rest.client.exceptions.FhirClientConnectionException;
import ca.uhn.fhir.rest.client.interceptor.BasicAuthInterceptor;
import ca.uhn.fhir.rest.client.interceptor.BearerTokenAuthInterceptor;
import ca.uhn.fhir.rest.gclient.IQuery;
Expand All @@ -47,9 +54,16 @@
import org.apache.http.impl.client.HttpClientBuilder;
import org.dcm4che3.net.audit.AuditLogger;
import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.hl7.fhir.r4.model.*;
import org.hl7.fhir.r4.model.Address;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.r4.model.CodeableConcept;
import org.hl7.fhir.r4.model.ContactPoint;
import org.hl7.fhir.r4.model.Extension;
import org.hl7.fhir.r4.model.HumanName;
import org.hl7.fhir.r4.model.Patient.PatientLinkComponent;
import org.hl7.fhir.r4.model.Reference;
import org.hl7.fhir.r4.model.StringType;
import org.hl7.fhir.r4.model.codesystems.LinkType;
import org.openmrs.Obs;
import org.openmrs.Patient;
Expand Down Expand Up @@ -89,6 +103,7 @@ public class FhirMpiClientServiceImpl implements MpiClientWorker, ApplicationCon
private MpiClientConfiguration m_configuration = MpiClientConfiguration.getInstance();

private ApplicationContext applicationContext;

@Autowired
private PatientTranslator patientTranslator;

Expand Down Expand Up @@ -494,19 +509,20 @@ public void exportPatient(MpiPatientExport patientExport) throws MpiClientExcept
}
}


IGenericClient client = this.getClient(false);
MethodOutcome result = client.create().resource(admitMessage).execute();

if (!result.getCreated())
throw new MpiClientException(
String.format("Error from MPI :> %s", result.getResource().getClass().getName()));

} catch (FhirClientConnectionException e) {
log.error("Error in FHIR PIX message", e);
} catch (MpiClientException e) {
log.error("Error in FHIR PIX message", e);
e.printStackTrace();
throw e;
} catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
log.error(e);
throw new MpiClientException(e);
Expand Down Expand Up @@ -648,4 +664,4 @@ public AuditLogger getAuditLogger() {
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
}
}