Search in sources :

Example 71 with Location

use of com.ibm.watson.compare_comply.v1.model.Location in project nia-patient-switching-standard-adaptor by NHSDigital.

the class LocationMapperTest method mapLocationWithAddressNoWP.

@Test
public void mapLocationWithAddressNoWP() {
    var ehrComposition = unmarshallCodeElement("address_without_wp_example.xml");
    var locationId = ehrComposition.getId().getRoot() + LOCATION_ID_EXTENSION;
    Location location = locationMapper.mapToLocation(ehrComposition.getLocation(), ehrComposition.getId().getRoot(), PRACTISE_CODE);
    assertThat(location.getId()).isEqualTo(ehrComposition.getId().getRoot() + LOCATION_ID_EXTENSION);
    assertThatIdentifierIsValid(location.getIdentifierFirstRep(), locationId);
    assertThat(location.getStatus()).isEqualTo(Location.LocationStatus.ACTIVE);
    assertThat(location.getMeta().getProfile().get(0).getValue()).isEqualTo(META_PROFILE);
    assertThat(location.getName()).isEqualTo(ehrComposition.getLocation().getLocatedEntity().getLocatedPlace().getName());
    assertThat(location.getAddress().isEmpty());
}
Also used : Location(org.hl7.fhir.dstu3.model.Location) Test(org.junit.jupiter.api.Test)

Example 72 with Location

use of com.ibm.watson.compare_comply.v1.model.Location in project nia-patient-switching-standard-adaptor by NHSDigital.

the class LocationMapperTest method mapLocationWithAddressAndPostcode.

@Test
public void mapLocationWithAddressAndPostcode() {
    var ehrComposition = unmarshallCodeElement("address_with_postcode_example.xml");
    var locationId = ehrComposition.getId().getRoot() + LOCATION_ID_EXTENSION;
    Location location = locationMapper.mapToLocation(ehrComposition.getLocation(), ehrComposition.getId().getRoot(), PRACTISE_CODE);
    assertThat(location.getId()).isEqualTo(ehrComposition.getId().getRoot() + LOCATION_ID_EXTENSION);
    assertThatIdentifierIsValid(location.getIdentifierFirstRep(), locationId);
    assertThat(location.getStatus()).isEqualTo(Location.LocationStatus.ACTIVE);
    assertThat(location.getMeta().getProfile().get(0).getValue()).isEqualTo(META_PROFILE);
    assertThat(location.getName()).isEqualTo(ehrComposition.getLocation().getLocatedEntity().getLocatedPlace().getName());
    assertThat(location.getAddress().getLine().toString()).isEqualTo(ehrComposition.getLocation().getLocatedEntity().getLocatedPlace().getAddr().getStreetAddressLine().toString());
    assertThat(location.getAddress().getPostalCode()).isEqualTo(ehrComposition.getLocation().getLocatedEntity().getLocatedPlace().getAddr().getPostalCode());
}
Also used : Location(org.hl7.fhir.dstu3.model.Location) Test(org.junit.jupiter.api.Test)

Example 73 with Location

use of com.ibm.watson.compare_comply.v1.model.Location in project nia-patient-switching-standard-adaptor by NHSDigital.

the class LocationMapperTest method mapLocationWithNoLocatedEntity.

@Test
public void mapLocationWithNoLocatedEntity() {
    var ehrComposition = unmarshallCodeElement("no_located_entity_example.xml");
    var locationId = ehrComposition.getId().getRoot() + LOCATION_ID_EXTENSION;
    Location location = locationMapper.mapToLocation(ehrComposition.getLocation(), ehrComposition.getId().getRoot(), PRACTISE_CODE);
    assertThat(location.getId()).isEqualTo(locationId);
    assertThatIdentifierIsValid(location.getIdentifierFirstRep(), locationId);
    assertThat(location.getStatus()).isEqualTo(Location.LocationStatus.ACTIVE);
    assertThat(location.getMeta().getProfile().get(0).getValue()).isEqualTo(META_PROFILE);
}
Also used : Location(org.hl7.fhir.dstu3.model.Location) Test(org.junit.jupiter.api.Test)

Example 74 with Location

use of com.ibm.watson.compare_comply.v1.model.Location in project nia-patient-switching-standard-adaptor by NHSDigital.

the class LocationMapperTest method mapLocationWithValidData.

@Test
public void mapLocationWithValidData() {
    var ehrComposition = unmarshallCodeElement("full_valid_location_example.xml");
    var locationId = ehrComposition.getId().getRoot() + LOCATION_ID_EXTENSION;
    Location location = locationMapper.mapToLocation(ehrComposition.getLocation(), ehrComposition.getId().getRoot(), PRACTISE_CODE);
    assertThat(location.getId()).isEqualTo(ehrComposition.getId().getRoot() + LOCATION_ID_EXTENSION);
    assertThatIdentifierIsValid(location.getIdentifierFirstRep(), locationId);
    assertThat(location.getStatus()).isEqualTo(Location.LocationStatus.ACTIVE);
    assertThat(location.getMeta().getProfile().get(0).getValue()).isEqualTo(META_PROFILE);
    assertThat(location.getName()).isEqualTo(ehrComposition.getLocation().getLocatedEntity().getLocatedPlace().getName());
    assertTelecom(location.getTelecomFirstRep(), ehrComposition.getLocation().getLocatedEntity().getLocatedPlace().getTelecom().get(0).getValue().substring(TEL_PREFIX_INT));
    assertThat(location.getAddress().getLine().toString()).isEqualTo(ehrComposition.getLocation().getLocatedEntity().getLocatedPlace().getAddr().getStreetAddressLine().toString());
    assertThat(location.getAddress().getPostalCode()).isEqualTo(ehrComposition.getLocation().getLocatedEntity().getLocatedPlace().getAddr().getPostalCode());
}
Also used : Location(org.hl7.fhir.dstu3.model.Location) Test(org.junit.jupiter.api.Test)

Example 75 with Location

use of com.ibm.watson.compare_comply.v1.model.Location in project metacat by Netflix.

the class S3ConnectorTableService method update.

@Override
public void update(@Nonnull final ConnectorRequestContext context, @Nonnull final TableInfo tableInfo) {
    log.debug("Start: Update table {}", tableInfo.getName());
    final QualifiedName tableName = tableInfo.getName();
    final Table table = tableDao.getBySourceDatabaseTableName(catalogName, tableName.getDatabaseName(), tableName.getTableName());
    if (table == null) {
        throw new TableNotFoundException(tableName);
    }
    // we can update the fields, the uri, or the full serde
    final Location newLocation = infoConverter.toLocation(tableInfo);
    Location location = table.getLocation();
    if (location == null) {
        location = new Location();
        location.setTable(table);
        table.setLocation(location);
    }
    if (newLocation.getUri() != null) {
        location.setUri(newLocation.getUri());
    }
    final Info newInfo = newLocation.getInfo();
    if (newInfo != null) {
        final Info info = location.getInfo();
        if (info == null) {
            location.setInfo(newInfo);
            newInfo.setLocation(location);
        } else {
            if (newInfo.getInputFormat() != null) {
                info.setInputFormat(newInfo.getInputFormat());
            }
            if (newInfo.getOutputFormat() != null) {
                info.setOutputFormat(newInfo.getOutputFormat());
            }
            if (newInfo.getOwner() != null) {
                info.setOwner(newInfo.getOwner());
            }
            if (newInfo.getSerializationLib() != null) {
                info.setSerializationLib(newInfo.getSerializationLib());
            }
            if (newInfo.getParameters() != null && !newInfo.getParameters().isEmpty()) {
                info.setParameters(newInfo.getParameters());
            }
        }
    }
    final Schema newSchema = newLocation.getSchema();
    if (newSchema != null) {
        final List<Field> newFields = newSchema.getFields();
        if (newFields != null && !newFields.isEmpty()) {
            final Schema schema = location.getSchema();
            if (schema == null) {
                location.setSchema(newSchema);
                newSchema.setLocation(location);
            } else {
                final List<Field> fields = schema.getFields();
                if (fields.isEmpty()) {
                    newFields.forEach(field -> {
                        field.setSchema(schema);
                        fields.add(field);
                    });
                } else {
                    for (int i = 0; i < newFields.size(); i++) {
                        final Field newField = newFields.get(i);
                        newField.setPos(i);
                        newField.setSchema(schema);
                        if (newField.getType() == null) {
                            newField.setType(newField.getSourceType());
                        }
                    }
                    schema.setFields(null);
                    fieldDao.delete(fields);
                    tableDao.save(table, true);
                    schema.setFields(newFields);
                }
            }
        }
    }
    log.debug("End: Update table {}", tableInfo.getName());
}
Also used : TableNotFoundException(com.netflix.metacat.common.server.connectors.exception.TableNotFoundException) Field(com.netflix.metacat.connector.s3.model.Field) Table(com.netflix.metacat.connector.s3.model.Table) QualifiedName(com.netflix.metacat.common.QualifiedName) Schema(com.netflix.metacat.connector.s3.model.Schema) Info(com.netflix.metacat.connector.s3.model.Info) TableInfo(com.netflix.metacat.common.server.connectors.model.TableInfo) Location(com.netflix.metacat.connector.s3.model.Location)

Aggregations

Test (org.junit.Test)120 Location (org.hl7.fhir.r4.model.Location)93 Location (org.hl7.fhir.dstu3.model.Location)66 IBundleProvider (ca.uhn.fhir.rest.api.server.IBundleProvider)59 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)42 BaseModuleContextSensitiveTest (org.openmrs.test.BaseModuleContextSensitiveTest)30 SearchParameterMap (org.openmrs.module.fhir2.api.search.param.SearchParameterMap)27 BaseFhirProvenanceResourceTest (org.openmrs.module.fhir2.providers.BaseFhirProvenanceResourceTest)21 StringAndListParam (ca.uhn.fhir.rest.param.StringAndListParam)20 StringOrListParam (ca.uhn.fhir.rest.param.StringOrListParam)20 StringParam (ca.uhn.fhir.rest.param.StringParam)20 ReferenceAndListParam (ca.uhn.fhir.rest.param.ReferenceAndListParam)16 ReferenceOrListParam (ca.uhn.fhir.rest.param.ReferenceOrListParam)16 ReferenceParam (ca.uhn.fhir.rest.param.ReferenceParam)16 MockIBundleProvider (org.openmrs.module.fhir2.providers.r4.MockIBundleProvider)16 TokenAndListParam (ca.uhn.fhir.rest.param.TokenAndListParam)13 Test (org.junit.jupiter.api.Test)13 ArrayList (java.util.ArrayList)11 HashSet (java.util.HashSet)11 TokenParam (ca.uhn.fhir.rest.param.TokenParam)10