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());
}
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;
}
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;
}
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;
}
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");
}
Aggregations