use of org.hl7.fhir.utilities.validation.ValidationMessage.Source in project BridgeServer2 by Sage-Bionetworks.
the class CRCControllerTest method createPatient.
@Test
public void createPatient() {
account.setId("userId");
account.setFirstName("Test");
account.setLastName("User");
account.setEmail(EMAIL);
account.setEmailVerified(true);
account.setPhone(PHONE);
account.setPhoneVerified(true);
account.setAttributes(new ImmutableMap.Builder<String, String>().put("address1", "123 Sesame Street").put("address2", "Apt. 6").put("city", "Seattle").put("dob", "1980-08-10").put("gender", "female").put("state", "WA").put("zip_code", "10001").put("home_phone", PHONE.getNumber()).build());
Patient patient = controller.createPatient(account);
assertTrue(patient.getActive());
assertEquals(patient.getIdentifier().get(0).getValue(), TEST_USER_ID);
assertEquals(patient.getIdentifier().get(0).getSystem(), USER_ID_VALUE_NS);
assertEquals(patient.getName().get(0).getGivenAsSingleString(), "Test");
assertEquals(patient.getName().get(0).getFamily(), "User");
assertEquals(patient.getMeta().getTag().get(0).getSystem(), "source");
assertEquals(patient.getMeta().getTag().get(0).getCode(), "sage");
assertEquals(patient.getGender().name(), "FEMALE");
assertEquals(LocalDate.fromDateFields(patient.getBirthDate()).toString(), "1980-08-10");
assertEquals(patient.getTelecom().get(0).getValue(), PHONE.getNumber());
assertEquals(patient.getTelecom().get(0).getSystem().name(), "PHONE");
assertEquals(patient.getTelecom().get(1).getValue(), PHONE.getNumber());
assertEquals(patient.getTelecom().get(1).getSystem().name(), "SMS");
assertEquals(patient.getTelecom().get(2).getValue(), EMAIL);
assertEquals(patient.getTelecom().get(2).getSystem().name(), "EMAIL");
Address address = patient.getAddress().get(0);
assertEquals(address.getLine().get(0).getValue(), "123 Sesame Street");
assertEquals(address.getLine().get(1).getValue(), "Apt. 6");
assertEquals(address.getCity(), "Seattle");
assertEquals(address.getState(), "WA");
assertEquals(address.getPostalCode(), "10001");
}
use of org.hl7.fhir.utilities.validation.ValidationMessage.Source in project quality-measure-and-cohort-service by Alvearie.
the class PathCaptureContext method reportProperty.
public void reportProperty(Property elm) {
// Log guarding to prevent some of the parameter resolution logic from getting called unnecessarily
if (LOG.isTraceEnabled()) {
LOG.trace("Property {} source {}", elm.getPath(), elm.getSource() != null ? elm.getSource().getClass().getSimpleName() : null);
}
Set<QName> modelTypeNames = null;
if (elm.getScope() != null || elm.getSource() instanceof AliasRef) {
String aliasName = (elm.getScope() != null) ? elm.getScope() : ((AliasRef) elm.getSource()).getName();
QueryAliasContext aliasContext = getCurrentQueryContext().resolveAlias(aliasName);
if (aliasContext == null) {
aliasContext = getCurrentExpressionContext().resolveAlias(aliasName);
}
modelTypeNames = ElmUtils.getModelTypeNames(aliasContext.getAliasedQuerySource().getExpression());
} else if (elm.getSource() instanceof QueryLetRef) {
String letName = ((QueryLetRef) elm.getSource()).getName();
QueryLetContext letContext = getCurrentQueryContext().resolveLet(letName);
if (letContext == null) {
letContext = getCurrentExpressionContext().resolveLet(letName);
}
modelTypeNames = ElmUtils.getModelTypeNames(letContext.getLetClause().getExpression());
} else {
// There are times when the scope is null. I've noticed this particularly when referencing properties
// of another expression result
modelTypeNames = ElmUtils.getModelTypeNames(elm.getSource());
}
LOG.trace("ModelTypeNames {}", modelTypeNames);
if (modelTypeNames != null) {
for (QName qname : modelTypeNames) {
pathsByQName.computeIfAbsent(qname, key -> new HashSet<>()).add(elm.getPath());
}
}
}
use of org.hl7.fhir.utilities.validation.ValidationMessage.Source in project integration-adaptor-111 by nhsconnect.
the class MessageHeaderServiceTest method shouldCreateMessageHeader.
@Test
public void shouldCreateMessageHeader() {
ItkReportHeader itkReportHeader = new ItkReportHeader();
itkReportHeader.setSpecKey(SPECIFICATION_KEY);
itkReportHeader.setSpecVal(SPECIFICATION_VALUE);
itkReportHeader.setAddressList(Arrays.asList(ADDRESS));
MessageHeader messageHeader = messageHeaderService.createMessageHeader(itkReportHeader, MESSAGEID, EFFECTIVE_TIME);
assertThat(messageHeader.getId()).isEqualTo(MESSAGEID);
Coding event = messageHeader.getEvent();
assertThat(event.getSystem()).isEqualTo(MessageHeaderEvent.SYSTEM);
assertThat(event.getCode()).isEqualTo(DISCHARGE_DETAILS.getCode());
assertThat(event.getDisplay()).isEqualTo(DISCHARGE_DETAILS.getDisplay());
MessageSourceComponent source = messageHeader.getSource();
assertThat(source.getName()).isEqualTo(MESSAGE_SOURCE_NAME);
assertThat(source.getEndpoint()).isEqualTo(ENDPOINT);
assertThat(messageHeader.getReason().getCodingFirstRep().getSystem()).isEqualTo(SPECIFICATION_KEY);
assertThat(messageHeader.getReason().getCodingFirstRep().getCode()).isEqualTo(SPECIFICATION_VALUE);
assertThat(messageHeader.getDestinationFirstRep().getEndpoint()).isEqualTo(ADDRESS);
assertThat(messageHeader.getTimestampElement()).isEqualToComparingFieldByField(DateUtil.parseToInstantType(EFFECTIVE_TIME));
}
use of org.hl7.fhir.utilities.validation.ValidationMessage.Source in project integration-adaptor-111 by nhsconnect.
the class MessageHeaderService method getSource.
private MessageSourceComponent getSource() {
MessageSourceComponent source = new MessageSourceComponent();
source.setName(MESSAGE_SOURCE_NAME);
source.setEndpoint(soapProperties.getSendTo());
return source;
}
use of org.hl7.fhir.utilities.validation.ValidationMessage.Source in project org.hl7.fhir.core by hapifhir.
the class R2R3ConversionManager method convertToR3.
private void convertToR3(InputStream source, OutputStream dest, FhirFormat format) throws FHIRException, IOException {
org.hl7.fhir.dstu3.elementmodel.Element r2 = new org.hl7.fhir.dstu3.elementmodel.XmlParser(contextR2).parse(source);
StructureMap map = library.get("http://hl7.org/fhir/StructureMap/" + r2.fhirType() + "2to3");
if (map == null)
throw new FHIRException("No Map Found from R2 to R3 for " + r2.fhirType());
String tn = smu3.getTargetType(map).getType();
Resource r3 = ResourceFactory.createResource(tn);
smu3.transform(new TransformContextR2R3(contextR3, r2.getChildValue("id")), r2, map, r3);
FormatUtilities.makeParser(format).setOutputStyle(style).compose(dest, r3);
}
Aggregations