Search in sources :

Example 26 with OperationOutcomeIssueComponent

use of org.hl7.fhir.r4b.model.OperationOutcome.OperationOutcomeIssueComponent in project pathling by aehrc.

the class JobProvider method buildProcessingOutcome.

@Nonnull
private static OperationOutcome buildProcessingOutcome() {
    final OperationOutcome opOutcome = new OperationOutcome();
    final OperationOutcomeIssueComponent issue = new OperationOutcomeIssueComponent();
    issue.setCode(IssueType.INFORMATIONAL);
    issue.setSeverity(IssueSeverity.INFORMATION);
    issue.setDiagnostics("Job currently processing");
    opOutcome.addIssue(issue);
    return opOutcome;
}
Also used : OperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent) OperationOutcome(org.hl7.fhir.r4.model.OperationOutcome) Nonnull(javax.annotation.Nonnull)

Example 27 with OperationOutcomeIssueComponent

use of org.hl7.fhir.r4b.model.OperationOutcome.OperationOutcomeIssueComponent in project MobileAccessGateway by i4mi.

the class Iti104ResponseConverter method translateToFhir.

/**
 * translate ITI-44 response to ITI-104 response
 */
public Object translateToFhir(byte[] input, Map<String, Object> parameters) {
    try {
        Patient request = (Patient) parameters.get(Utils.KEPT_BODY);
        String query = (String) parameters.get("FhirHttpQuery");
        Identifier identifier = Iti104RequestConverter.identifierFromQuery(query);
        // FIX for xmlns:xmlns
        String content = new String(input);
        content = content.replace("xmlns:xmlns", "xmlns:xxxxx");
        MCCIIN000002UV01Type msg = HL7V3Transformer.unmarshallMessage(MCCIIN000002UV01Type.class, new ByteArrayInputStream(content.getBytes()));
        for (net.ihe.gazelle.hl7v3.mccimt000200UV01.MCCIMT000200UV01Acknowledgement akk : msg.getAcknowledgement()) {
            CS code = akk.getTypeCode();
            if (!code.getCode().equals("AA") && !code.getCode().equals("CA")) {
                OperationOutcome outcome = new OperationOutcome();
                for (MCCIMT000200UV01AcknowledgementDetail detail : akk.getAcknowledgementDetail()) {
                    OperationOutcomeIssueComponent issue = outcome.addIssue();
                    issue.setDetails(new CodeableConcept().setText(toText(detail.getText())).addCoding(transform(detail.getCode())));
                }
                throw new InvalidRequestException("Retrieved error response", outcome);
            // return new MethodOutcome(outcome).setCreated(false);
            }
        }
        MethodOutcome out = new MethodOutcome(new IdType(noPrefix(identifier.getSystem()) + "-" + identifier.getValue()));
        OperationOutcome outcome = new OperationOutcome();
        out.setOperationOutcome(outcome);
        return out;
    } catch (JAXBException e) {
        throw new InvalidRequestException("failed parsing response");
    }
}
Also used : MCCIMT000200UV01AcknowledgementDetail(net.ihe.gazelle.hl7v3.mccimt000200UV01.MCCIMT000200UV01AcknowledgementDetail) OperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent) JAXBException(javax.xml.bind.JAXBException) Patient(org.hl7.fhir.r4.model.Patient) MethodOutcome(ca.uhn.fhir.rest.api.MethodOutcome) IdType(org.hl7.fhir.r4.model.IdType) MCCIIN000002UV01Type(net.ihe.gazelle.hl7v3.mcciin000002UV01.MCCIIN000002UV01Type) CS(net.ihe.gazelle.hl7v3.datatypes.CS) Identifier(org.hl7.fhir.r4.model.Identifier) ByteArrayInputStream(java.io.ByteArrayInputStream) OperationOutcome(org.hl7.fhir.r4.model.OperationOutcome) InvalidRequestException(ca.uhn.fhir.rest.server.exceptions.InvalidRequestException) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 28 with OperationOutcomeIssueComponent

use of org.hl7.fhir.r4b.model.OperationOutcome.OperationOutcomeIssueComponent in project MobileAccessGateway by i4mi.

the class Iti78ResponseConverter method error.

public OperationOutcome error(IssueType type, String diagnostics) {
    OperationOutcome result = new OperationOutcome();
    OperationOutcomeIssueComponent issue = result.addIssue();
    issue.setSeverity(OperationOutcome.IssueSeverity.ERROR);
    issue.setCode(type);
    issue.setDiagnostics(diagnostics);
    return result;
}
Also used : OperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent) OperationOutcome(org.hl7.fhir.r4.model.OperationOutcome)

Example 29 with OperationOutcomeIssueComponent

use of org.hl7.fhir.r4b.model.OperationOutcome.OperationOutcomeIssueComponent in project gpconnect-demonstrator by nhsconnect.

the class PatientResourceProvider method addWarningIssue.

/**
 * see
 * https://gpconnect-1-2-4.netlify.com/accessrecord_structured_development_version_compatibility.html
 * add an issue to the OperationOutcome to be returned in a successful
 * response bundle this is for forward compatibility as specified in 1.2.4
 *
 * @param param
 * @param paramPart
 * @param issueType
 * @param details lower level details to be added to the text element
 */
private void addWarningIssue(ParametersParameterComponent param, ParametersParameterComponent paramPart, IssueType issueType, String details) {
    if (operationOutcome == null) {
        createOperationOutcome();
    }
    OperationOutcomeIssueComponent issue = new OperationOutcomeIssueComponent();
    issue.setSeverity(OperationOutcome.IssueSeverity.WARNING);
    CodeableConcept codeableConcept = new CodeableConcept();
    Coding coding = new Coding();
    coding.setSystem(VS_GPC_ERROR_WARNING_CODE);
    switch(issueType) {
        case NOTSUPPORTED:
            issue.setCode(issueType);
            coding.setCode(SystemCode.NOT_IMPLEMENTED);
            coding.setDisplay("Not implemented");
            break;
        case REQUIRED:
            issue.setCode(issueType);
            coding.setCode(SystemCode.PARAMETER_NOT_FOUND);
            coding.setDisplay("Parameter not found");
            break;
        case INVALID:
            issue.setCode(issueType);
            coding.setCode(SystemCode.INVALID_PARAMETER);
            coding.setDisplay("Invalid Parameter");
            break;
    }
    codeableConcept.addCoding(coding);
    issue.setDetails(codeableConcept);
    String locus = paramPart != null ? "." + paramPart.getName() : "";
    issue.setDiagnostics(param.getName() + locus);
    if (details == null) {
        // mod to remove more informative text which was off spec
        codeableConcept.setText(param.getName() + locus + " is an unrecognised parameter");
    } else {
        codeableConcept.setText(details);
    }
    operationOutcome.addIssue(issue);
}
Also used : OperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent)

Example 30 with OperationOutcomeIssueComponent

use of org.hl7.fhir.r4b.model.OperationOutcome.OperationOutcomeIssueComponent in project gpconnect-demonstrator by nhsconnect.

the class OperationOutcomeFactory method buildOperationOutcomeException.

/**
 * @param exception carries message used for diagnostics
 * @param code
 * @param issueType
 * @param diagnostics may be null but will override exception.message if set
 * @return BaseServerResponseException
 */
public static BaseServerResponseException buildOperationOutcomeException(BaseServerResponseException exception, String code, IssueType issueType, String diagnostics) {
    CodeableConcept codeableConcept = new CodeableConcept();
    Coding coding = new Coding(SystemURL.VS_GPC_ERROR_WARNING_CODE, code, code);
    codeableConcept.addCoding(coding);
    OperationOutcome operationOutcome = new OperationOutcome();
    OperationOutcomeIssueComponent ooIssue = new OperationOutcomeIssueComponent();
    ooIssue.setSeverity(IssueSeverity.ERROR).setDetails(codeableConcept).setCode(issueType);
    if (diagnostics != null) {
        ooIssue.setDiagnostics(diagnostics);
    } else {
        // #248 move exception.getMessage() from text to diagnostics element
        ooIssue.setDiagnostics(exception.getMessage());
    }
    operationOutcome.addIssue(ooIssue);
    operationOutcome.getMeta().addProfile(SystemURL.SD_GPC_OPERATIONOUTCOME);
    exception.setOperationOutcome(operationOutcome);
    return exception;
}
Also used : Coding(org.hl7.fhir.dstu3.model.Coding) OperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent) OperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Aggregations

OperationOutcomeIssueComponent (org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent)23 OperationOutcome (org.hl7.fhir.r4.model.OperationOutcome)20 Test (org.junit.jupiter.api.Test)17 OperationOutcomeIssueComponent (org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent)10 Order (org.junit.jupiter.api.Order)10 TestMethodOrder (org.junit.jupiter.api.TestMethodOrder)10 RestIntegrationTest (org.opencds.cqf.ruler.test.RestIntegrationTest)10 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)10 OperationOutcomeIssueComponent (org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent)8 OperationOutcome (org.hl7.fhir.dstu3.model.OperationOutcome)7 OperationOutcome (org.hl7.fhir.r5.model.OperationOutcome)5 CacheVerificationLogger (org.hl7.fhir.utilities.tests.CacheVerificationLogger)5 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)5 ValidationEngine (org.hl7.fhir.validation.ValidationEngine)5 BufferedReader (java.io.BufferedReader)4 InputStreamReader (java.io.InputStreamReader)4 Nonnull (javax.annotation.Nonnull)4 ValueSet (org.hl7.fhir.dstu3.model.ValueSet)4 IBaseOperationOutcome (org.hl7.fhir.instance.model.api.IBaseOperationOutcome)3 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)3