Search in sources :

Example 46 with Annotation

use of org.hl7.fhir.r5.model.Annotation in project bunsen by cerner.

the class FhirEncodersTest method annotation.

@Test
public void annotation() throws FHIRException {
    Annotation original = medRequest.getNoteFirstRep();
    Annotation decoded = decodedMedRequest.getNoteFirstRep();
    Assert.assertEquals(original.getText(), medDataset.select(functions.expr("note[0].text")).head().get(0));
    Assert.assertEquals(original.getText(), decoded.getText());
    Assert.assertEquals(original.getAuthorReference().getReference(), decoded.getAuthorReference().getReference());
}
Also used : Annotation(org.hl7.fhir.dstu3.model.Annotation) Test(org.junit.Test)

Example 47 with Annotation

use of org.hl7.fhir.r5.model.Annotation in project bunsen by cerner.

the class TestData method newMedRequest.

/**
 * Returns a FHIR medication request for testing purposes.
 */
public static MedicationRequest newMedRequest() {
    MedicationRequest medReq = new MedicationRequest();
    medReq.setId("test-med");
    // Medication code
    CodeableConcept med = new CodeableConcept();
    med.addCoding().setSystem("http://www.nlm.nih.gov/research/umls/rxnorm").setCode("582620").setDisplay("Nizatidine 15 MG/ML Oral Solution [Axid]");
    med.setText("Nizatidine 15 MG/ML Oral Solution [Axid]");
    medReq.setMedication(med);
    Annotation annotation = new Annotation();
    annotation.setText("Test medication note.");
    annotation.setAuthor(new Reference("Provider/example").setDisplay("Example provider."));
    medReq.addNote(annotation);
    return medReq;
}
Also used : MedicationRequest(org.hl7.fhir.dstu3.model.MedicationRequest) Reference(org.hl7.fhir.dstu3.model.Reference) Annotation(org.hl7.fhir.dstu3.model.Annotation) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 48 with Annotation

use of org.hl7.fhir.r5.model.Annotation in project clinical_quality_language by cqframework.

the class Cql2ElmVisitor method buildAnnotation.

private Annotation buildAnnotation(Chunk chunk) {
    Annotation annotation = af.createAnnotation();
    annotation.setS(buildNarrative(chunk));
    return annotation;
}
Also used : Annotation(org.hl7.cql_annotations.r1.Annotation)

Example 49 with Annotation

use of org.hl7.fhir.r5.model.Annotation in project clinical_quality_language by cqframework.

the class DataRequirementsProcessor method extractLogicDefinitions.

private List<Extension> extractLogicDefinitions(ElmRequirementsContext context, ElmRequirements requirements) {
    List<Extension> result = new ArrayList<Extension>();
    int sequence = 0;
    for (ElmRequirement req : requirements.getExpressionDefs()) {
        ExpressionDef def = (ExpressionDef) req.getElement();
        org.hl7.cql_annotations.r1.Annotation a = getAnnotation(def);
        if (a != null) {
            result.add(toLogicDefinition(req, def, toNarrativeText(a), sequence++));
        }
    }
    return result;
}
Also used : ElmRequirement(org.cqframework.cql.elm.requirements.ElmRequirement) org.hl7.elm.r1(org.hl7.elm.r1)

Example 50 with Annotation

use of org.hl7.fhir.r5.model.Annotation in project dpc-app by CMSgov.

the class ParamResourceFactoryTest method testUnnamedResource.

@Test
void testUnnamedResource() throws IOException {
    final Parameters parameters = new Parameters();
    final Patient dummyPatient = new Patient();
    parameters.addParameter().setResource(dummyPatient);
    final HttpServletRequest mock = Mockito.mock(HttpServletRequest.class);
    final ServletInputStream mockStream = Mockito.mock(ServletInputStream.class);
    final IParser parser = Mockito.mock(IParser.class);
    Mockito.when(parser.parseResource(Mockito.eq(Parameters.class), Mockito.any(InputStream.class))).thenReturn(parameters);
    final Injector mockInjector = Mockito.mock(Injector.class);
    Mockito.when(mockInjector.getInstance(HttpServletRequest.class)).thenReturn(mock);
    Mockito.when(mock.getInputStream()).thenReturn(mockStream);
    final Parameter parameter = Mockito.mock(Parameter.class);
    final FHIRParameter annotation = Mockito.mock(FHIRParameter.class);
    Mockito.when(annotation.name()).thenReturn("");
    Mockito.when(parameter.getAnnotation(FHIRParameter.class)).thenReturn(annotation);
    Mockito.when(parameter.getRawType()).thenAnswer(answer -> Patient.class);
    final ParamResourceFactory factory = new ParamResourceFactory(mockInjector, parameter, parser);
    assertTrue(dummyPatient.equalsDeep((Patient) factory.provide()), "Should have returned dummy patient");
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) Parameters(org.hl7.fhir.dstu3.model.Parameters) ServletInputStream(javax.servlet.ServletInputStream) ServletInputStream(javax.servlet.ServletInputStream) InputStream(java.io.InputStream) Injector(com.google.inject.Injector) FHIRParameter(gov.cms.dpc.fhir.annotations.FHIRParameter) Patient(org.hl7.fhir.dstu3.model.Patient) FHIRParameter(gov.cms.dpc.fhir.annotations.FHIRParameter) Parameter(org.glassfish.jersey.server.model.Parameter) IParser(ca.uhn.fhir.parser.IParser) Test(org.junit.jupiter.api.Test)

Aggregations

NotImplementedException (org.apache.commons.lang3.NotImplementedException)14 Trace (com.newrelic.api.agent.Trace)13 Operation (gov.cms.bfd.server.war.Operation)13 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)12 Annotation (org.hl7.fhir.r4.model.Annotation)12 NoResultException (javax.persistence.NoResultException)11 ResourceNotFoundException (ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException)9 Annotation (org.hl7.fhir.dstu3.model.Annotation)9 Search (ca.uhn.fhir.rest.annotation.Search)8 OffsetLinkBuilder (gov.cms.bfd.server.war.commons.OffsetLinkBuilder)8 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)8 Read (ca.uhn.fhir.rest.annotation.Read)7 Beneficiary (gov.cms.bfd.model.rif.Beneficiary)7 Patient (org.hl7.fhir.dstu3.model.Patient)7 ArrayList (java.util.ArrayList)6 List (java.util.List)6 Collectors (java.util.stream.Collectors)6 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)6 Resource (org.hl7.fhir.r4.model.Resource)6 Test (org.junit.jupiter.api.Test)6