Search in sources :

Example 36 with ServerGeoObjectType

use of net.geoprism.registry.model.ServerGeoObjectType in project geoprism-registry by terraframe.

the class DHIS2AttributeMapping method writeStandardAttributes.

public void writeStandardAttributes(VertexServerGeoObject serverGo, JsonObject jo, DHIS2SyncConfig dhis2Config, DHIS2SyncLevel level) {
    if (this.isStandardAttribute()) {
        ServerGeoObjectType got = level.getGeoObjectType();
        AttributeType attr = got.getAttribute(this.getCgrAttrName()).get();
        Object value = serverGo.getValue(attr.getName());
        if (value == null || (value instanceof String && ((String) value).length() == 0)) {
            return;
        }
        this.writeAttributeValue(attr, this.dhis2AttrName, value, jo);
    }
}
Also used : ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) AttributeType(org.commongeoregistry.adapter.metadata.AttributeType) JsonObject(com.google.gson.JsonObject) VertexServerGeoObject(net.geoprism.registry.model.graph.VertexServerGeoObject)

Example 37 with ServerGeoObjectType

use of net.geoprism.registry.model.ServerGeoObjectType in project geoprism-registry by terraframe.

the class DHIS2AttributeMapping method writeCustomAttributes.

public void writeCustomAttributes(JsonArray attributeValues, VertexServerGeoObject serverGo, DHIS2SyncConfig dhis2Config, DHIS2SyncLevel syncLevel, String lastUpdateDate, String createDate) {
    if (this.isCustomAttribute()) {
        ServerGeoObjectType got = syncLevel.getGeoObjectType();
        AttributeType attr = got.getAttribute(this.getCgrAttrName()).get();
        Object value = serverGo.getValue(attr.getName());
        if (value == null || (value instanceof String && ((String) value).length() == 0)) {
            return;
        }
        JsonObject av = new JsonObject();
        av.addProperty("lastUpdated", lastUpdateDate);
        av.addProperty("created", createDate);
        this.writeAttributeValue(attr, "value", value, av);
        JsonObject joAttr = new JsonObject();
        joAttr.addProperty("id", this.getExternalId());
        av.add("attribute", joAttr);
        attributeValues.add(av);
    }
}
Also used : ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) AttributeType(org.commongeoregistry.adapter.metadata.AttributeType) JsonObject(com.google.gson.JsonObject) JsonObject(com.google.gson.JsonObject) VertexServerGeoObject(net.geoprism.registry.model.graph.VertexServerGeoObject)

Example 38 with ServerGeoObjectType

use of net.geoprism.registry.model.ServerGeoObjectType in project geoprism-registry by terraframe.

the class MCSDFhirDataPopulator method populate.

@Override
public void populate(Business row, Facility facility) {
    super.populate(row, facility);
    ServerGeoObjectType type = this.getList().getGeoObjectType();
    String label = type.getLabel().getValue();
    String system = this.getContext().getSystem();
    CodeableConcept concept = new CodeableConcept().setText(label).addCoding(new Coding(system, type.getCode(), label));
    Location location = facility.getLocation();
    location.addType(concept);
    location.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.Location");
    Organization organization = facility.getOrganization();
    organization.addType(concept);
    organization.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.Organization");
    if (type.getGeometryType().equals(GeometryType.MULTIPOINT)) {
        location.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.FacilityLocation");
        location.addType(new CodeableConcept().addCoding(new Coding("urn:ietf:rfc:3986", "urn:ihe:iti:mcsd:2019:facility", "Facility")));
        location.setPhysicalType(new CodeableConcept().setText("Building").addCoding(new Coding("http://terminology.hl7.org/CodeSystem/location-physical-type", "bu", "Building")));
        organization.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.FacilityOrganization");
        organization.addType(new CodeableConcept().addCoding(new Coding("urn:ietf:rfc:3986", "urn:ihe:iti:mcsd:2019:facility", "Facility")));
    } else {
        location.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.JurisdictionLocation");
        location.addType(new CodeableConcept().addCoding(new Coding("urn:ietf:rfc:3986", "urn:ihe:iti:mcsd:2019:jurisdiction", "Jurisdiction")));
        location.setPhysicalType(new CodeableConcept().setText("Jurisdiction").addCoding(new Coding("http://terminology.hl7.org/CodeSystem/location-physical-type", "jdn", "Jurisdiction")));
        organization.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.JurisdictionsOrganization");
        organization.addType(new CodeableConcept().addCoding(new Coding("urn:ietf:rfc:3986", "urn:ihe:iti:mcsd:2019:jurisdiction", "Jurisdiction")));
    }
    if (this.hierarchies.size() > 1) {
        for (ServerHierarchyType hierarchy : this.hierarchies) {
            this.addHierarchyExtension(row, facility, hierarchy);
        }
    } else if (this.hierarchies.size() == 1) {
        this.setPartOf(row, facility, this.hierarchies.get(0));
    }
}
Also used : ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) Organization(org.hl7.fhir.r4.model.Organization) Coding(org.hl7.fhir.r4.model.Coding) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Location(org.hl7.fhir.r4.model.Location)

Example 39 with ServerGeoObjectType

use of net.geoprism.registry.model.ServerGeoObjectType in project geoprism-registry by terraframe.

the class TolkienFhirDataPopulator method populate.

@Override
public void populate(Business row, Facility facility) {
    super.populate(row, facility);
    ServerGeoObjectType type = this.getList().getGeoObjectType();
    String label = type.getLabel().getValue();
    String system = this.getContext().getSystem();
    CodeableConcept concept = new CodeableConcept().setText(label).addCoding(new Coding(system, type.getCode(), label));
    Location location = facility.getLocation();
    location.addType(concept);
    location.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.Location");
    Organization organization = facility.getOrganization();
    organization.addType(concept);
    organization.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.Organization");
    if (type.getGeometryType().equals(GeometryType.MULTIPOINT)) {
        location.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.FacilityLocation");
        location.addType(new CodeableConcept().addCoding(new Coding("urn:ietf:rfc:3986", "urn:ihe:iti:mcsd:2019:facility", "Facility")));
        location.setPhysicalType(new CodeableConcept().setText("Building").addCoding(new Coding("http://terminology.hl7.org/CodeSystem/location-physical-type", "bu", "Building")));
        organization.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.FacilityOrganization");
        organization.addType(new CodeableConcept().addCoding(new Coding("urn:ietf:rfc:3986", "urn:ihe:iti:mcsd:2019:facility", "Facility")));
    } else {
        location.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.JurisdictionLocation");
        location.addType(new CodeableConcept().addCoding(new Coding("urn:ietf:rfc:3986", "urn:ihe:iti:mcsd:2019:jurisdiction", "Jurisdiction")));
        location.setPhysicalType(new CodeableConcept().setText("Jurisdiction").addCoding(new Coding("http://terminology.hl7.org/CodeSystem/location-physical-type", "jdn", "Jurisdiction")));
        organization.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.JurisdictionsOrganization");
        organization.addType(new CodeableConcept().addCoding(new Coding("urn:ietf:rfc:3986", "urn:ihe:iti:mcsd:2019:jurisdiction", "Jurisdiction")));
    }
    // if (this.hierarchies.size() > 1)
    {
        for (ServerHierarchyType hierarchy : this.hierarchies) {
            this.addHierarchyExtension(row, facility, hierarchy);
        }
    }
// else if (this.hierarchies.size() == 1)
// {
// this.setPartOf(row, facility, this.hierarchies.get(0));
// }
}
Also used : ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) Organization(org.hl7.fhir.r4.model.Organization) Coding(org.hl7.fhir.r4.model.Coding) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Location(org.hl7.fhir.r4.model.Location)

Example 40 with ServerGeoObjectType

use of net.geoprism.registry.model.ServerGeoObjectType in project geoprism-registry by terraframe.

the class GeoObjectImporter method setTermValue.

protected void setTermValue(ServerGeoObjectIF entity, AttributeType attributeType, String attributeName, Object value, Date startDate, Date endDate) {
    if (!this.configuration.isExclusion(attributeName, value.toString())) {
        try {
            ServerGeoObjectType type = this.configuration.getType();
            MdBusinessDAOIF mdBusiness = type.getMdBusinessDAO();
            MdAttributeTermDAOIF mdAttribute = (MdAttributeTermDAOIF) mdBusiness.definesAttribute(attributeName);
            if (mdAttribute == null && type.getSuperType() != null) {
                mdAttribute = (MdAttributeTermDAOIF) type.getSuperType().getMdBusinessDAO().definesAttribute(attributeName);
            }
            Classifier classifier = Classifier.findMatchingTerm(value.toString().trim(), mdAttribute);
            if (classifier == null) {
                Term rootTerm = ((AttributeTermType) attributeType).getRootTerm();
                TermReferenceProblem trp = new TermReferenceProblem(value.toString(), rootTerm.getCode(), mdAttribute.getOid(), attributeName, attributeType.getLabel().getValue());
                trp.addAffectedRowNumber(this.progressListener.getWorkProgress() + 1);
                trp.setHistoryId(this.configuration.getHistoryId());
                this.progressListener.addReferenceProblem(trp);
            } else {
                entity.setValue(attributeName, classifier.getOid(), startDate, endDate);
            }
        } catch (UnknownTermException e) {
            TermValueException ex = new TermValueException();
            ex.setAttributeLabel(e.getAttribute().getLabel().getValue());
            ex.setCode(e.getCode());
            throw e;
        }
    }
}
Also used : MdBusinessDAOIF(com.runwaysdk.dataaccess.MdBusinessDAOIF) TermValueException(net.geoprism.registry.io.TermValueException) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) MdAttributeTermDAOIF(com.runwaysdk.dataaccess.MdAttributeTermDAOIF) Classifier(net.geoprism.ontology.Classifier) Term(org.commongeoregistry.adapter.Term) AttributeTermType(org.commongeoregistry.adapter.metadata.AttributeTermType) TermReferenceProblem(net.geoprism.registry.etl.TermReferenceProblem) UnknownTermException(org.commongeoregistry.adapter.dataaccess.UnknownTermException)

Aggregations

ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)201 Request (com.runwaysdk.session.Request)69 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)57 JsonObject (com.google.gson.JsonObject)48 ServerGeoObjectIF (net.geoprism.registry.model.ServerGeoObjectIF)32 JsonArray (com.google.gson.JsonArray)30 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)30 MdVertexDAOIF (com.runwaysdk.dataaccess.MdVertexDAOIF)27 LinkedList (java.util.LinkedList)27 Test (org.junit.Test)27 VertexObject (com.runwaysdk.business.graph.VertexObject)26 AttributeType (org.commongeoregistry.adapter.metadata.AttributeType)26 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)23 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)23 Date (java.util.Date)21 GraphQuery (com.runwaysdk.business.graph.GraphQuery)19 List (java.util.List)18 EdgeObject (com.runwaysdk.business.graph.EdgeObject)17 SimpleDateFormat (java.text.SimpleDateFormat)17 Locale (java.util.Locale)17